我想使用滑动手势在我的标签栏之间导航.最简单的方法是什么?我试过这样的事......
import UIKit
class postAdViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
var leftSwipe = UISwipeGestureRecognizer(target: self, action: Selector("handleSwipes:"))
view.addGestureRecognizer(leftSwipe)
}
func handleSwipes(sender:UISwipeGestureRecognizer) {
if (sender.direction == .left) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "favourireviewcontroller") as! UIViewController
self.present(vc, animated: true, completion: nil)
}
if (sender.direction == .right) {
}
}
Run Code Online (Sandbox Code Playgroud)
如果我试图向右滑动没有任何反应.滑动时,应用程序崩溃以下错误消息
无法识别的选择器发送到实例0x7f924380a730