Reputation: 241
So I have somewhat of a silly requirement, I am trying to put an "easter egg" type function into the app, where if you tap a certain area 3 times, a special view controller comes up with some silly pictures, etc...
I created a UIView and added a UITapGestureRecognizer to it. but when I set the background color to "clear" (to effectively hide the view) it doesn't respond to the tap.
How can I make the view "invisible" and yet still active? I want to use a UIView because I've set it to respond to multiple taps, which is why I didn't use a UIButton
Upvotes: 4
Views: 375
Reputation: 1338
If it is the case where alpha < 0.1 starts ignoring events (I never heard that either), you could drop in a 1x1pt custom view/control where the 1px showing has a color that matches its background and has an alpha > 0.1,
Then override:
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
to return YES
for a larger area than the 1x1 pt.
Upvotes: 2