Reputation: 3885
I have a side panel that has a UIImageView to which I attached a UIPanGestureRecognizer so that you could push/pull the sidebar. It works well.
Thing is that I have some buttons that happen to sometimes occur underneath that sidebar. If I pull it and a button is underneath, the button would fire simultaneously with the Pan.
I am not sure what the problem is, so I find it hard to solve. Why does my UIImageView pass the UIPanGestureRecognizer event on down the chain?
Upvotes: 0
Views: 227
Reputation: 3885
Problem solved with delegation. I disable the events on toucheBegan if a BOOL called isPanning is set to YES for all buttons. The protocol defines only one function:
-(void)setPanning:(BOOL)isPanning;
in the touchedBegan I check to see if the value is YES, if so I don't fire that event. I wished it would be simpler.
Upvotes: 1