简体   繁体   中英

Disable user interaction on tabBar

I am displaying an image right after the app didFinishLaunchingWithOptions , the app consists in a tab bar, and in the first view i have some buttons. The user can only continue to use the app after he press the button in that first image, the problem is, some users can interact with the tab bar, and the buttons in the first view even with the image above all. How i can completely disable the user interaction on those buttons and in the tabBar, and enable then only when the button is pressed and the image disapear?

To disable:

UITabBarController.tabBar.userInteractionEnabled = NO;

To enable:

UITabBarController.tabBar.userInteractionEnabled = YES;
  if let items =  self.tabBarController?.tabBar.items {

        for i in 0 ..< items.count {

            let itemToDisable = items[i]
            itemToDisable.isEnabled = false

        }
    }

somehow i didn't fully understand what you described,but have you tried disabling your buttons using following code?

    button1.Enabled=false;

also you can disable images click function using

    image1.Enabled=false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM