0

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?

Ted
  • 3,805
  • 14
  • 56
  • 98
  • I'm not terribly familiar with this, but I think you might find your answer by looking through [this question](http://stackoverflow.com/questions/4825199/gesture-recognizer-and-button-actions). – GeneralMike Nov 26 '12 at 14:28

1 Answers1

1

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.

Ted
  • 3,805
  • 14
  • 56
  • 98