views:

28

answers:

1

I find that the View do not have a touch inside or similar event. So, I make a button on top on the view, and set it Alpha to 0, but after I set to Alpha 0, it cannot touch anymore. Any ideas on this?

+1  A: 

You can use UIView subclass and handle touch event there. Methods to look at (defined in UIResponder):

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event

If you want to use "invisible" UIButton you should set its type to UIButtonTypeCustom - by default it will appear with no image and title and with transparent background. So technically it will be invisible to user but still be able to respond to all events.

Vladimir