我有一个简单的绘图工具,一个带有AspectFit的UIImageView,它不是完整的窗口,而是在ImageView中的UIImage。
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
if ([touch tapCount] == 2) {
_imageView2.image = _introImage2;
}
location = [touch locationInView:touch.view];
lastClick = [NSDate date];
lastPoint = [touch locationInView:self.imageView2];
lastPoint.y -= 0;
[super touchesBegan: touches withEvent: event];
}
如果UIImageView是全窗口,这项工作是正确的。如何仅为UIImageView设置UITouch?