ios - 以模态方式呈现 ViewController 时如何禁用所有 UITabBarItems?
问题描述
我已经在我的应用程序中实现了UITabBar。在一个 UITabBar 项目的 ViewController 中,我展示了另一个以模态方式呈现的 ViewController 。在这个阶段,我想禁用所有 UITabBar 项目并在willdisappear中重新启用。
在下面的委托中,如果我得到呈现的模态 ViewController,那么在比较时我可以返回而无需任何操作。但我对如何获得模态呈现的可见 ViewController 感到困惑。这种方法会奏效吗?
(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
//HOW CAN I GET HERE VISIBLE VIEWCONTROLLER I.E. PRESENTED MODALLY VIEWCONTROLLER.
}
解决方案
禁用:
self.tabBarController.tabBar.userInteractionEnabled = NO;
使能够
self.tabBarController.tabBar.userInteractionEnabled = YES;
推荐阅读
- android - 在 Android 中,我有 2 个按钮和一个文本。我必须在左边安排一个按钮,在中间安排一个按钮,在右边安排一个按钮。我怎样才能做到这一点?
- android - 在子 ID 中更新子 ID
- javascript - 无需重复的密码生成器 google sheet 脚本编辑器
- docker - Jenkins:无法在 Docker 容器中运行命令
- maven - 设置 Jenkins 以运行特定的 maven 命令
- python - 如何在opencv python中使用相机依次找到方向?
- python - 我们如何计算在 python 中实现的算法的不同数据大小的内存使用量
- spring-boot - DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE 在 H2 中不起作用
- php - Codeigniter 重定向()未按预期工作
- javascript - 需要从同一文件中导出同一目录下的两个模块不起作用