I\'ve added a UIView
containing a UITapGestureRecognizer
as my key window\'s subview. It shows properly, however when I tap my view, the target met
When this happens to me it's usually because I screwed up my UIView
frame. I see all the content as expected because my UIView
isn't clipping to bounds, but I can't interact with anything because my taps are outside the bounds of the UIView
.
My simple test is to change the background color of the UIView
and see if it covers the area I expect or if I screwed up size/placement somehow.
I used to pound my head against the wall with this issue, struggling for hours, but I've done it so many times now it's 5min fix of "Oh that again".
Edit:
Then I'd look at your show
code. Your calling code isn't here, but if I'm to assume your are just using your show
code and your view is only on screen for 3 seconds, then that's you problem.
As Justin mentioned (comment above) and Apple's docs
During an animation, user interactions are temporarily disabled for all views involved in the animation, regardless of the value in this property. You can disable this behavior by specifying the UIViewAnimationOptionAllowUserInteraction option when configuring the animation.
Since the entire time your view is on the screen it's part of an animation block, all interaction will be disable for the entire time it's visible. I've never quite tested the delay
bit and whether animation was disabled during that piece, but it would not surprise me animation is disabled during the delay. The second animation is still inside the primary animation block, so I'd assume animations will be blocked until both are complete.