ios - Using gesture recognizers that dynamically stick to one touch among many -


i have view 4 pan gestures attached. first has both max , min number of touches set 1, second 2, etc. makes each recognize 1 touch while 4 fingers slide around on screen.

that's working dandy. isn't working detecting when individual touches end. have set happen when gesture ends happens when gestures have ended completely.

example delegate method:

- (void) handlepan:(uipangesturerecognizer*)recognizer {      //setting happens when gesture recognized beginning     if (recognizer.state == uigesturerecognizerstatebegan) {      //...whatever happens, bunnies follow finger or whatever      } else      //setting happens when gesture ends     if ((recognizer.state == uigesturerecognizerstateended) |          (recognizer.state == uigesturerecognizerstatecancelled) |         (recognizer.state == uigesturerecognizerstatefailed)) {          nslog(@"end");      } } 

what should happening see "end" in console whenever finger lifted. instead, see nothing until fingers lifted, @ point see "end" repeated 4 times (or many times fingers on screen).

is there way can make work way intend?

edit after fiddling see may not analyzing problem correctly. whole reason want detect when gesture's touch ends want have gestures able become active when there more 1 touch on screen, want each gesture track 1 touch itself. setting "active" flag on gestures tracking touches, , toggling flag off after touches ended, , wasn't working, because touch-end-detection hard implement well.

but if there's different way achieve same thing, that's real thing i'm looking for: among many overlapping touches, have each gesture recognizer track 1 , one.

you may want - catches change in fingers on screen given gesture; may need add more logic surrounding gesture you're working with:

switch( recognizer.numberoftouches ) {      case 1: {          nslog(@"1 ");          break;      }      case 2: {          nslog(@"2");          break;      }      case 3: {           nslog(@"3");           break;      }      case 4: {           nslog(@"4");           break;      }      default: {           nslog(@"0");      } } 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -