interactivePopGestureRecognizer corrupts navigation stack on root view controller

后端 未结 5 1457
攒了一身酷
攒了一身酷 2021-02-12 11:19

In my UINavigationController I added custom back buttons with the side effect that it is not possible anymore to swipe left to right to pop the view controller and

5条回答
  •  孤街浪徒
    2021-02-12 12:03

    My current solution is to disable the interactivePopGestureRecognizer in the root view controller:

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
    
        self.navigationController?.interactivePopGestureRecognizer?.enabled = false
    }
    

    In the first child view controller I enable it again. But this seems to be more a workaround because I don't understand the actual problem why the navigation stack got messed up in the first place.

提交回复
热议问题