[英]Swift - PanGesture Recognizer - move with object - speed of movement
[英]PanGesture Recognizer not working. [Swift]
我想使用Pangesture(拖动视图)返回上一个视图,但我不能。 我只能在屏幕的左边缘执行“平移”功能,比如说5%。 当前视图的另一个区域“手势”功能不起作用。 有什么方法可以使我回到Pangesture的根视图吗? 请指教。 谢谢。
var pan = UIPanGestureRecognizer(target: self, action: "handlePanGesture:")
self.mainView.addGestureRecognizer(pan)
func handlePanGesture(recognizer: UIPanGestureRecognizer) {
var touchLocation = recognizer.translationInView(self.view)
????
}
这是在情节提要板上使用UIPanGestureRecognizer设置的视图控制器的示例:
ViewController:
class PhotoDetaislViewController: UIViewController {
// the connection
@IBOutlet var swipeRight: UISwipeGestureRecognizer!
override func viewDidLoad() {
super.viewDidLoad()
//Swipe navigation
swipeRight.addTarget(self, action: "swipeRight:") // sets up the swipeRight var
}
func swipeRight(sender: UISwipeGestureRecognizer) {
// do your navigation here
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.