这是我用在我的项目&它工作正常。
UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[self.view addGestureRecognizer:singleFingerTap];
- (void)handleSingleTap:(UITapGestureRecognizer *)recognizer {
CGPoint location = [recognizer locationInView:[recognizer.view superview]];
//Do stuff here...
// I assume that your imgview is imgView11
if (imgView11.frame.origin.x < location.x && location.x < something
&& imgView11.frame.origin.y < location.y && location.y < something) {
largeImgView.image = imgView11.image;
}
}
如果你可以分享你的代码部件,那么我将编辑我的回答对HP解决您的问题