我有以下代码来确定触摸是否在我的表格单元格的图像视图中。但是,它不起作用。我将两者与 CGRectContainsPoint 进行了比较,但是它不起作用。这是代码:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// Declare the touch and get it's location
UITouch *touch = [touches anyObject];
CGPoint touchLocation = [touch locationInView:self];
if (CGRectContainsPoint(myImageView.frame, touchLocation))
{
NSLog(@"Tapped image view");
}
}
谢谢您的帮助!