- //当有一个或多个手指触摸事件在当前视图或window窗体中响应
- -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- {
- NSSet *allTouches = [event allTouches]; //返回与当前接收者有关的所有的触摸对象
- UITouch *touch = [allTouches anyObject]; //视图中的所有对象
- CGPoint point = [touch locationInView:[touch view]]; //返回触摸点在视图中的当前坐标
- int x = point.x; //x轴坐标
- int y = point.y; //y轴坐标
- }
获取当前触摸点坐标
最新推荐文章于 2023-01-30 09:11:05 发布