如何在iOS应用程序中获取图像坐标?

时间:2013-02-21 08:03:10

标签: ios ipad drawing signature coordinate-transformation

我必须在我的iPad应用程序中实现签名功能。我将签名转换为图像,然后我想获得该图像的坐标。我怎么能这样帮助我。

注意:我不是在谈论纬度和经度。我在谈论像素坐标

1 个答案:

答案 0 :(得分:0)

UIViewControllerUIResponder的子类,因此您可以实施方法touchesBegan:withEvent:touchesMoved:withEvent:touchesEnded:withEvent:touchesCancelled:withEvent:来检测“签署运动“。

例如,使用方法-touchesMoved:withEvent:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint currentPosition = [touch locationInView:self.view];
    NSLog(@"%@", NSStringFromCGPoint(currentPosition));
}

有关详情,请查看UIResponder班级的documentation