我想确定点击的位置是否在区域内。我有 4 个 CGPoints,我知道这可以通过使用 UITouch 来完成。另外,我使用该功能在屏幕上点击了位置
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *myTouch = [[touches allObjects] objectAtIndex: 0];
CGPoint currentPos = [myTouch locationInView:self.view];
}
例如我的 4 个 CGPoints 是
self.firstPoint = CGPointMake(50.0f, 50.0f);
self.secondPoint = CGPointMake(200.0, 50.0);
self.thirdPoint = CGPointMake(200.0, 200.0);
self.fourthPoint = CGPointMake(50.0, 120.0);
提前致谢