UITabBarController's viewControllers present modal controller issue

前端 未结 1 621
别跟我提以往
别跟我提以往 2021-01-26 09:47

I have a UITabBarController with 4 viewControllers setup.

One of the controller has a button that present another controller (wrapped on UINavigationController) with the

相关标签:
1条回答
  • 2021-01-26 10:46

    If this is the same bug that I demonstrate here, the workaround I give is to prevent the user from switching to another tab while this tab is showing the presented view controller:

    override func viewDidLoad() {
        super.viewDidLoad()
        self.tabBarController?.delegate = self
    }
    extension FirstViewController : UITabBarControllerDelegate {
        func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
            return self.presentedViewController == nil
        }
    }
    
    0 讨论(0)
提交回复
热议问题