Regarding the looks and gesture recognizers

So, I have a slightly stupid requirement, I'm trying to include a function like "Easter egg" in the application, where if you click on a certain area 3 times, a special view controller will come up with some stupid 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 does not respond to clicks.

How can I make the view invisible and still active? I want to use UIView because I configured it on several taps, so I did not use UIButton

+4
source share
1 answer

If this is the case when alpha-0.1 starts to ignore events (I never heard about it), you can go to the user view / control 1x1pt, where the 1px-display has a color corresponding to its background and has alpha> 0.1.

Then override:

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event 

to return YES for a larger area than 1x1 pt.

+2
source

All Articles