iphone - How to cancel uitouches? -
in app want have users tap on left side of screen increase speed , swipe on right side work joystick. however, if user keeps holding left side, joystick doesn't work right.
i using touchesbegan, touchesmoved, etc. there way cancel info first touch , have joystick separately?
i tried [self touchescancelled: touches withevent: event];
there other way?
the cocoa touch framework multi-touch aware. therefore don't have cancel first touch work second touch. enumerate touches , use 1 want joystick in touch delegate.
nsarray *alltouches = [ touches allobjects ]; int numtouches = [ alltouches count ]; (int i=0; i<numtouches; i++) { uitouch *thetouch = [ alltouches objectatindex:i ]; if (thetouch != leftsideholdtouch) { // maybe it's joystick touch, handle here } }
Comments
Post a Comment