我有DrawingView並在其上偵聽UIPanGestureRecognizer,UIRotationGestureRecognizer和UIPinchGestureRecognizer。當PinchGesture處於活動狀態時,RotationGesture不會調用
- (void)viewDidLoad
{
[super viewDidLoad];
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)];
[self.drawingView addGestureRecognizer:panRecognizer];
UIRotationGestureRecognizer *rotateRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotateRecognizer:)];
[self.drawingView addGestureRecognizer:rotateRecognizer];
UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchRecognizer:)];
[self.drawingView addGestureRecognizer:pinchRecognizer];
[self.drawingView reloadData];
}
-(void) pinchRecognizer:(UIPinchGestureRecognizer*) recognizer {
return;
NSLog(@"Call scale");
}
- (void)rotateRecognizer:(UIRotationGestureRecognizer*)recognizer {
NSLog(@"Call rotaion");
}
如果我只選擇了UIRotationGestureRecognizer或UIPinchGestureRecognizer,那就完美了。但是如果使用UIRotationGestureRecognizer和UIPinchGestureRecognizer,則只調用UIPinchGestureRecognizer,而不調用UIRotationGestureRecognizer。 我的代碼中有什麼問題? 我想我會做一個UISegmented選擇模式,UIRotationGestureRecognizer或UIPinchGestureRecognizer,我該怎麼辦?
感謝很多
僅供參考,您的NSCH在您的捏識別器方法是「返回」後,所以它不會打印出來。 –