如何使Swift 3中的TAB栏禁用用户交互



在此期间,在此期间,在此期间将项目添加到购物车中,而活动指示器在此期间为动画进行动画,用户应该无法访问标签栏项目,任何人都可以帮助我如何帮助我实施此?

这是我的代码

 var tabbarController = UITabBarController()
 loginCheck = UserDefaults.standard.integer(forKey: "CustomerLogin")
        print(loginCheck!)
        let storyBoard = UIStoryboard(name: "Main", bundle: nil)
        let vc1 = storyBoard.instantiateViewController(withIdentifier: "cartViewController") as! AddToCartViewController
        let vc2 = storyBoard.instantiateViewController(withIdentifier: "searchCategories") as! SearchCategoriesViewController
        let vc3 = storyBoard.instantiateViewController(withIdentifier: "myAccount") as! MyAccountViewController
        tabbarController.viewControllers = [vc1,vc2,vc3]
        let tabItems = self.tabBarController?.tabBar.items as NSArray!
        let tabItem = tabItems?[1] as! UITabBarItem

如果要处理整个应用程序用户互动,请执行以下 -

禁用用户交互:

 UIApplication.shared.beginIgnoringInteractionEvents() 

启用用户交互:

if(UIApplication.shared.isIgnoringInteractionEvents){
        UIApplication.shared.endIgnoringInteractionEvents()
    }

最新更新