我有一个通用的二进制应用程序,目前正在iPad版本的应用程序上工作。 iPad使用的是uitabbarcontroller,第二个选项卡上有6张图片,添加UIPinchGesture时没有响应。我有userInteractionEnabled=YES;
我尝试以编程方式添加图像视图,然后添加手势识别器,但仍然没有任何工作。UIPinchGestureRecognizer没有响应
我试着将代理设置到视图控制器并实现其中一个代理方法,但没有得到任何响应。下面是我在做什么的代码示例:
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");
}
我敢肯定,这是愚蠢的东西我失踪。我之前使用过这些东西,但不能为我的生活找出错误的地方。
我解决我自己的问题显然不知何故,我设法不小心把我在界面生成器视图中启用的用户交互。 -1为愚蠢。 – dbslone 2011-06-01 19:37:51