我编写了以下代码来将手势识别器附加到多个图像视图。
[imageview1 setUserInteractionEnabled:YES];
[imageview1 setMultipleTouchEnabled:YES];
[imageview2 setUserInteractionEnabled:YES];
[imageview2 setMultipleTouchEnabled:YES];
[imageview3 setUserInteractionEnabled:YES];
[imageview3 setMultipleTouchEnabled:YES];
[imageview4 setUserInteractionEnabled:YES];
[imageview4 setMultipleTouchEnabled:YES];
[imageview5 setUserInteractionEnabled:YES];
[imageview5 setMultipleTouchEnabled:YES];
[imageview6 setUserInteractionEnabled:YES];
[imageview6 setMultipleTouchEnabled:YES];
UILongPressGestureRecognizer *gestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(gestureHandler:)];
gestureRecognizer.delegate = self;
[imageview1 addGestureRecognizer:gestureRecognizer];
[imageview2 addGestureRecognizer:gestureRecognizer];
[imageview3 addGestureRecognizer:gestureRecognizer];
[imageview4 addGestureRecognizer:gestureRecognizer];
[imageview5 addGestureRecognizer:gestureRecognizer];
[imageview6 addGestureRecognizer:gestureRecognizer];我注意到了两个问题!
,
有人能告诉我如何处理这些问题吗?
谢谢。
发布于 2012-04-03 14:04:16
UIGestureRecognizer一次只能附加到一个视图上。您必须为每个图像视图创建一个单独的视图。
https://stackoverflow.com/questions/9994850
复制相似问题