UITabBarController's viewControllers present modal controller issue

不打扰是莪最后的温柔 提交于 2019-12-02 09:40:50

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
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!