[关闭]
@HelloJansen 2016-07-28T05:42:00.000000Z 字数 255 阅读 679

iOS 获取当前点击坐标

touch


  1. - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
  2. {
  3. NSSet *allTouch = [event allTouches];
  4. UITouch *touch = [allTouch anyObject];
  5. CGPoint point = [touch locationInView:[touch view]];
  6. int x = point.x;
  7. int y = point.y;
  8. NSLog(@"x,y == (%d, %d)", x, y);
  9. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注