user8949932
user8949932

Reputation:

how to make user interaction disable for tab bar in swift 3?

Here while adding item to cart at that time activity indicator will animate during this time while activity indicator animates during this time user should not able to access the tab bar items can anyone help me how to implement this ?

here is my code for this

 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

Upvotes: 1

Views: 1351

Answers (1)

Amir Khan
Amir Khan

Reputation: 1318

If you want to handle whole app user interaction then do the following-

To disable User interaction:

 UIApplication.shared.beginIgnoringInteractionEvents() 

To enable User interaction:

if(UIApplication.shared.isIgnoringInteractionEvents){

        UIApplication.shared.endIgnoringInteractionEvents()

    }

Upvotes: 1

Related Questions