interactivePopGestureRecognizer corrupts navigation stack on root view controller

后端 未结 5 1586
攒了一身酷
攒了一身酷 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 11:52

    func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
        self.interactivePopGestureRecognizer?.isEnabled = self.viewControllers.count > 1
    }
    

    Updated @rivera solution for Swift 5

提交回复
热议问题