I'm adding subviews with tap gestures:
from UIView class(masterButton):
[self addSubview:self.button]; // Add gesture recognizers [self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(isTapped:)]];
ViewController:
masterButton *button = [[masterButton alloc] initWithFrontImage:img ];
[self.view addSubview:button];
I removing the subview:
UIView * button= [controller.view viewWithTag:controller.tagButton]; [button removeFromSuperview];
The tap gesture it triggers to play audio file and works just fine but when I remove the subview and I tap the same area where the subview was it plays the audio like if the subview was there. How can I add the subview in a way were the main view is not responding to any gesture of the subviews?
I'm generating the subviews from UIview subclass and if I try to add the gesture like this:
[self.button addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(isTapped:)]];
it doesn't work. any of you knows why?
I'll really appreciate your help.