ios 怎么获得触摸屏幕的坐标

2025-04-25 07:18:09
推荐回答(1个)
回答1:

通过Touch的相应函数来获得:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self];
//touchPoint.x ,touchPoint.y 就是触点的坐标。

}

看些基础的教程里基本都会讲到这个的,