简体   繁体   English

禁用tabBar上的用户交互

[英]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. 我正在应用程序didFinishLaunchingWithOptions后显示一个图像,该应用程序包含在一个标签栏中,在第一个视图中我有一些按钮。 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? 如何完全禁用这些按钮和tabBar中的用户交互,然后仅在按下按钮并且图像消失时启用?

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 MKMapView 上禁用用户交互? - How to disable user interaction on MKMapView? 如何为MGLAnnotation禁用用户交互? - How to disable user interaction for MGLAnnotation? 如何禁用除滚动交互外的UIWebView中的所有用户交互 - how to disable all user interaction in UIWebView except scroll interaction 如何在发生交互时禁用UICollectionView中的用户交互 - how to disable user interaction in a UICollectionView while an interaction is occurring 带有链接的UITextView:禁用滚动,启用用户交互 - UITextView with links: disable scrolling, user interaction enabled 如何在没有用户交互的情况下禁用wifi协助 - how to disable wifi assist without user interaction 如何在AVAudioSession期间禁用用户交互 - How to disable user Interaction during AVAudioSession 禁用UIWebView的缩放,但保持其他用户交互 - Disable zoom in a UIWebView but keep other user interaction 如何在UITableViewCell的某些位置上禁用用户交互? - How to disable user interaction on certain location of UITableViewCell? 禁用用户交互但允许在UIViewController中点击手势 - Disable user interaction but allow tap gesture in UIViewController
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM