我正在使用 UITabBarController 开发一个 iOS 应用程序。我想在第二个子viewController(One button action)中设置第一个tabbaritem的用户交互为NO,即视图流程为:
firstTabbarItem -> firstChildView ->secondChildView ->buttonClick(设置 firstTabbarItem userInteraction 为 NO)。
如何实现这一点?
我正在使用 UITabBarController 开发一个 iOS 应用程序。我想在第二个子viewController(One button action)中设置第一个tabbaritem的用户交互为NO,即视图流程为:
firstTabbarItem -> firstChildView ->secondChildView ->buttonClick(设置 firstTabbarItem userInteraction 为 NO)。
如何实现这一点?
您可以直接访问标签栏项目:
self.tabBarController.tabBar.selectedItem.enabled = NO;
只需在您的按钮处理程序中调用它。
你可以看看
UITabbarControllerDelegate,您可以让您的 AppDelegate 实现该协议,并对 TabbarController:shouldSelectViewController 做出响应