Question
I have a .xib with a UIButton
. That UIButton
has a connection via Touch Up Inside
to a method, - (IBAction)play:(id)sender
, in the File's Owner.
When I run on a first-gen iPad the UIButton
shows it's highlighted state when tapped, but doesn't call the connected method. I set a breakpoint at the first line of the method, and it's never hit.
When I run the app on a second-gen iPad, everything works properly.
I've hacked blindly at the issue a bit, but I'm hoping someone else has an insight to what might be going on. Any idea what I'm overlooking?
Update, partial solution
Thanks to Stavash's help, I see that the source of the issue is the gesture recognizer attached to the view containing the button.
When I remove the gesture recognizer, everything works.
I see a related question that indicates a solution using the UIGestureRecognizerDelegate
to prevent the gesture recognizer from responding when the button is tapped.
However, even though the delegate method is returning NO
when the button is tapped, the Touch Up Inside
event still doesn't seem to be firing.
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if ((touch.view == self.playButton)) {
return NO;
}
return YES;
}
code taken from related question, linked above
I'll experiment some more tomorrow, and post again if I figure out where I went wrong.