ios - How to prefer tap gesture over draw gesture? -
in view i'm overriding "touches*" methods let user draw on screen. i'm recording locations. in addition have 2 gesture recognizers on view detect single tap , double tap. if move finger little bit , short enough, recording small "draw" gesture. when raising finger, additional tap gesture triggered. trial , error possibly figure out minimum time , movement threshold i'm sure there smarter ways? need know after how movement and/or save assume no tap gesture trigger.
you can avoid tap gestures. instead of can recognize taps in touch events itself.
- (void)touchesended:(nsset*)touches withevent:(uievent*)event { if(touches.count == 1) { if([[touches anyobject] tapcount] == 1) { // action here single tap } else if([[touches anyobject] tapcount] == 2) { // action here double tap } } }
and have set global bool variable check whether user moved finger on screen.
bool _ismoved;
and make true in touch move event
- (void)touchesmoved:(nsset*)touches withevent:(uievent*)event { _ismoved = yes; }
before recording track, check whether flag true or not? , dont forget make flag false after saving track
hope :)
Comments
Post a Comment