iOS 获取当前点击的坐标

 

 1 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
 2 
 3 {
 4     NSSet *allTouch = [event allTouches];
 5     UITouch *touch = [allTouch anyObject];
 6     CGPoint point = [touch locationInView:[touch view]];
 7     int x = point.x;
 8     int y = point.y;
 9     NSLog(@"x,y == (%d, %d)", x, y);
10 }

 

posted @ 2017-02-04 10:44  Leo-Wmw  阅读(1832)  评论(0编辑  收藏  举报