Say I have this code:
#import
@interface MyView : UIView
@end
@implementation MyView
- (void)touchesMoved:(NSSet *)touches withEvent:
May I suggest using this approach instead:
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(tapDetected:)];
tapRecognizer.numberOfTapsRequired = 1;
tapRecognizer.numberOfTouchesRequired = 1;
[self.view addGestureRecognizer:tapRecognizer];
You can do this from the superview, no need to make custom UI elements.