スワイプジェスチャーを使用してタブバーを移動したい。それを行う最も簡単な方法は何ですか?私はこのようなものを試しました...スワイプジェスチャーを使用してタブバーを移動する
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) {
}
}
私は右にスワイプしようとすると何も起こりません。
認識されないセレクターがインスタンスに送信される次のエラーメッセージが左スワイプアプリクラッシュ0x7f924380a730