我有一个通用二进制应用程序,目前正在使用该应用程序的 iPad 版本。iPad 正在使用 uitabbarcontroller,在第二个选项卡上我有 6 张图像,当添加 UIPinchGesture 时它没有响应。我userInteractionEnabled=YES;
试过以编程方式添加图像视图,然后添加手势识别器,但似乎仍然没有任何效果。
我尝试将委托设置为视图控制器并实现其中一种委托方法,但没有得到任何响应。下面是我正在做的代码示例:
UIImageView *img2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img2-large.png"]];
img2.frame = CGRectMake(20, 20, 100, 100);
[img2 setUserInteractionEnabled:YES];
img2.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:img2];
UIPinchGestureRecognizer *img2Pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(img2Pinch:)];
[img2 addGestureRecognizer:img2Pinch];
[img2Pinch release];
- (void)img2Pinch:(UIPinchGestureRecognizer *)sender {
NSLog(@"HERE");
}
我确定我错过了一些愚蠢的事情。我以前用过这个东西,但我一生都无法弄清楚出了什么问题。