How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem?

前端 未结 14 1026
遥遥无期
遥遥无期 2020-11-28 22:48

I got the opposite issue from here. By default in iOS7, back swipe gesture of UINavigationController\'s stack could pop the presented ViewCon

14条回答
  •  伪装坚强ぢ
    2020-11-28 23:08

    For those who are still having trouble with this, try separating the two lines as below.

    override func viewDidLoad() {
        self.navigationController!.interactivePopGestureRecognizer!.delegate = self
        ...
    
    override func viewWillAppear(_ animated: Bool) {
        self.navigationController!.interactivePopGestureRecognizer!.isEnabled = true
        ...
    

    Obviously, in my app,

    interactivePopGestureRecognizer!.isEnabled

    got reset to false before the view was shown for some reason.

提交回复
热议问题