我正在使用UIPanGestureRecognizer将CALayer从一个UIView拖到另一个UIView。在UIGestureRecognizerState.Changed方法中,我正在调用将CALayer与
var touchLocation = recognizer.locationInView(recognizer.view)
self.panForTranslation(touchLocation)
但是touchLocation返回相对于其框架的CALayers位置,而不是屏幕坐标。
如何获取手指在屏幕上确切点的UITouch位置?
试试这个:
var touchLocation = recognizer.locationInView(recognizer.view.window)
self.panForTranslation(touchLocation)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句