Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UIPinchGestureRecognitor';s触摸位置_Iphone_Cocoa Touch_Uigesturerecognizer_Pinch - Fatal编程技术网

Iphone UIPinchGestureRecognitor';s触摸位置

Iphone UIPinchGestureRecognitor';s触摸位置,iphone,cocoa-touch,uigesturerecognizer,pinch,Iphone,Cocoa Touch,Uigesturerecognizer,Pinch,我想在我的iphone应用程序中实现带捏手势的缩放。问题是,在识别手势时调用的方法中,我无法访问触摸事件本身(因此我无法真正获取它们的位置查看:),我希望获得它以便正确地将放大居中 在UIPinchGestureRecognitor类定义中,有一个UITouch*\u触摸[2]; 已定义,但我无法从类外访问它。我能做些什么来获取数据吗 我没有找到更简单的方法: 您可以创建自定义UIPinchGestureRecognitor,并为UITouches创建两个属性。在触摸开始和触摸移动时指定其值。然

我想在我的iphone应用程序中实现带捏手势的缩放。问题是,在识别手势时调用的方法中,我无法访问触摸事件本身(因此我无法真正获取它们的
位置查看:
),我希望获得它以便正确地将放大居中

UIPinchGestureRecognitor
类定义中,有一个
UITouch*\u触摸[2];

已定义,但我无法从类外访问它。我能做些什么来获取数据吗

我没有找到更简单的方法:

您可以创建自定义UIPinchGestureRecognitor,并为UITouches创建两个属性。在触摸开始和触摸移动时指定其值。然后只需访问这些属性就可以找到触摸的位置


这就是我所做的,效果很好。希望有帮助。

希望有帮助

这一定是过时了。您可以在PinchGestureRecognitor上查询NumberOfTouch,然后在查看中查询locationOfTouch:(NSInteger)touchIndex: