I am experiencing this strange behavior.
I create a clean project (view template), add a toolbar with a button and hook it up with an action. it works ;) BUT, then when I add a UITapGestureRecognizer to the view of my viewcontroller the toolbar button stops working. (It is pressed but its action is not called) When I add the UITapGestureRecognizer only the action linked to it is called. It is like uitapgesture recognizer view were hiding the toolbar but actually is not.
What is happening here? What am I missing?
- (IBAction)itemAction{
NSLog(@"%s", _cmd);
self.view.backgroundColor = [UIColor whiteColor];
}
- (void) tapAction{
NSLog(@"%s", _cmd);
self.view.backgroundColor = [UIColor greenColor];
}
- (void)viewWasTapped:(UITapGestureRecognizer *)recognizer{
if (recognizer.state == UIGestureRecognizerStateRecognized) {
[self tapAction];
}
}
- (void)viewDidLoad {
[super viewDidLoad];
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewWasTapped:)];
[tapGestureRecognizer setNumberOfTapsRequired:1];
[self.view addGestureRecognizer:tapGestureRecognizer];
[tapGestureRecognizer release];
}
EDIT: the project source can be downloaded from here
Thanks in advance for any advice
Ignacio