I’ve been using a UITapGestureRecognizer for quite some time now to take notice when a tap occurs and to display another view. I’m initializing it like this:
_tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showModalDetailView:)];
In iOS 4.3, that did work perfectly. In iOS 5, -showModalDetailView: does not get called anymore.
I was wondering if anyone else has this issue, too?
Update
I’m configuring the recognizer like this:
_tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showModalDetailView:)];
_tapGesture.numberOfTapsRequired = 1;
_tapGesture.numberOfTouchesRequired = 1;
_tapGesture.delegate = self;
[self addGestureRecognizer:_tapGesture];
Update 2
Ok, now it gets weird. The code starts working again once I disable the delegate setting by commenting it. However, the delegate methods are still being called. But not always.
The cell has a left aligned title and a right aligned detail text. When you hit the detail text it works as expected: The delegate method does not get called and the popover appears. When you hit the cell somewhere else, the delegate method (-gestureRecognizer:shouldReceiveTouch: in this case) gets called and the popover appears.
I don’t quite get what’s going on here.
Now that I implement all three delegate methods (though they’re optional) it works. Just returning the default values. Thanks, Dunkelstern and thomas.