【问题标题】:How to get image coordinates in iOS app?如何在 iOS 应用程序中获取图像坐标?
【发布时间】:2013-02-21 08:03:09
【问题描述】:

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

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

【问题讨论】:

  • 界面设计如何?用户是登录UIImageView 还是UIView?您对哪些坐标感兴趣,尊重容器视图或 globals 坐标?
  • 用户在 UIView 上绘图
  • 好的,你对哪个坐标感兴趣?
  • 我想要协调像素
  • 是否要将图像裁剪到用户签名的区域?

标签: ios ipad drawing signature coordinate-transformation


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-14
    • 1970-01-01
    • 1970-01-01
    • 2018-04-25
    • 2023-04-05
    • 2020-09-15
    • 1970-01-01
    • 2016-02-04
    相关资源
    最近更新 更多