1
如何將UIPinchGestureRecognizer
用於多種用途?目前我正在使用它來放大/縮小我的GLKView,但我想使用手勢來移動(平移/傾斜),但同時可以縮放。我已經在iOS上的許多CAD和3D應用程序中看到過這種行爲。捏合手勢用於縮放和平移/傾斜
代碼捏:
- (void)pinchDetected:(UIPinchGestureRecognizer *)pinchRecognizer
{
NSLog (@"%@", @"Pinching");
if (pinchRecognizer.state == UIGestureRecognizerStateBegan ||
pinchRecognizer.state == UIGestureRecognizerStateChanged ||
pinchRecognizer.state == UIGestureRecognizerStateEnded) {
_zoom += (-1)*(logf(pinchRecognizer.scale) * 10.0f);
pinchRecognizer.scale = 1.0;
}
}
與使用UIPinchGestureRecognizer相比,您鏈接到的特定代碼示例中的觸摸事件有什麼不同嗎? – JavaCake
除了某些編碼和函數調用之外,它沒有任何區別 –