iOS 获取当前点击的坐标

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    NSSet *allTouch = [event allTouches];
    UITouch *touch = [allTouch anyObject];
    CGPoint point = [touch locationInView:[touch view]];
    int x = point.x;
    int y = point.y;
    NSLog(@"x,y == (%d, %d)", x, y);
}

posted on 2016-07-28 13:44  哈喽mybaby  阅读(569)  评论(1编辑  收藏  举报

导航