views:

18

answers:

1

Hi.

I'm working in small app for iPhone which uses openGL.

The app is supossed to :

Move around the screen with a moving touch. Zoom in/Out by tapping

I'm overwritting this functions to handle the coordinates of the touchs and move around the screen with my finger, with success, working perfectly:

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

I'm using UIGesture recognizers to double taps, pinch gestures, swipes, counter pinch with success as well, all gestures being detected perfectly.

But I'm having conflicts. Some times for example, I do a double tap and it's recognized correctly, but it's also passed to my touchedMoved fucntion, resulting in errratic movements. Same thing happens with pinch and counter pinch gestures, most of the time they work well in zooming in and out, but some times my touchesMoved function detect the touchs as well and moves the screen.

It's a bad practice to overwrite this functions and use UIGesturerecognizer at the same time ?. If not, it's there a way to work with both without conflicts ?

I tried setting setDelaysTouchesBegan and setDelaysTouchesEnded to Yes in my recognizers, but this results in my touches not being passed to none of my overwrited functions!

I was thinking in using UIGestureRecognizer to handle swipes and scrap the overwrited functions to receive touches, and use the value of the swipe to calculate how much move my screen, it's possible ?

Thanks.

+1  A: 

I can't answer for why you sometimes receive spurious touchesMoved: events, but it does sound like you may want to just ditch the overwritten functions and use a UIPanGestureRecognizer to handle moving around the screen.

Kevin Ballard
Sorry to ask but, UIPanGestureRecognizer allows me to know the direction and the distance of the pan gesture ?, in order for me to determine how much to move the screen in a direction ?. I saw this has an velocity output, but i'm not sure of it's meaning. Thanks !
José Joel.
nevermind, did a little search and everything worked perfectly. Thanks !
José Joel.