In iOS development, by default, only one gesture can be executed at a time.Uigesturerecognizerdelegate and rewrite the Function
-(Bool) Gesturerecognizer :(Uigesturerecognizer*) Gesturerecognizer shouldrecognizesimultaneouslywithgesturerecognizer :(Uigesturerecognizer
*) Othergesturerecognizer
Taking the pinch and rotation gestures as an example, the first step is to add gestures:
Uigesturerecognizer * recognizer; recognizer = [[uirotationgesturerecognizer alloc] initwithtarget: Self action: @ selector (handlerotationfrom :)]; recognizer. cancelstouchesinview = no; recognizer. delegate = self; [self. view progress: recognizer]; [recognizer release]; Role * recognizer2; recognizer2 = [[using alloc] initwithtarget: Self action: @ selector (handlepinch :)]; Role = no; recognizer2.delegate = self; [self. view addgesturerecognizer: recognizer2]; [recognizer2 release];
Then rewrite the function mentioned above. You only need to return YES.
-(Bool) gesturerecognizer :( uigesturerecognizer *) gesturerecognizer
shouldrecognizesimultaneouslywithgesturerecognizer :( uigesturerecognizer *) othergesturerecognizer {return yes;}