我不确定为什么在执行此操作时不会调用目标:
UIImage * imgSrc = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageSource]]];
UIImageView * imgView = [[[UIImageView alloc] initWithImage:imgSrc] retain];
UIPinchGestureRecognizer * pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(resizeImage:)];
[imgView addGestureRecognizer:pinchGestureRecognizer];
[pinchGestureRecognizer release];
- (IBAction)resizeImage:(UIPinchGestureRecognizer *)sender
{
//not getting here
}
调用大小调整图像不会被调用。图像显示得很好
答案 0 :(得分:1)
您需要设置imgView.userInteractionEnabled = YES。它默认为“NO”。