In my view controller, I add a UITapGestureRecognizer to self.view. And I add a small view on top of self.view. When I tap the small view, I don't want to trigger the UITapGestureRecognizer event in self.view. Here is my code, it doesn't work.
- (void)viewDidLoad {
[super viewDidLoad];
UITapGestureRecognizer *_tapOnVideoRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleControlsVisible)];
[self.view addGestureRecognizer:_tapOnVideoRecognizer];
UIView *smallView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
smallView.backgroundColor=[UIColor redColor];
smallView.exclusiveTouch=YES;
smallView.userInteractionEnabled=YES;
[self.view addSubview:smallView];
}
- (void)toggleControlsVisible
{
NSLog(@"tapped");
}
When I tap the small view, it still triggers the tap event in self.view. Xcode logs "tapped". How to intercept the gesture event from smallView to self.view?