如何在 swift 3 中禁用标签栏的用户交互?
how to make user interaction disable for tab bar in swift 3?
此时将商品添加到购物车时,activity 指示器将在此期间进行动画处理,而 activity 指示器将在此期间进行动画处理用户应该无法访问标签栏项目谁能帮我如何实施?
这是我的代码
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()
}
此时将商品添加到购物车时,activity 指示器将在此期间进行动画处理,而 activity 指示器将在此期间进行动画处理用户应该无法访问标签栏项目谁能帮我如何实施?
这是我的代码
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()
}