【问题标题】:Access UITabBarController to assign action via Storyboards访问 UITabBarController 以通过 Storyboards 分配操作
【发布时间】:2016-02-14 04:33:40
【问题描述】:

没有情节提要,我可以简单地分配UITabBarController.delegate = self(例如AppDelegate)。这让我可以处理按下UITabBar 上的UITabBarButton 时发生的情况。

但是,我现在使用故事板,其中我的 UIViewController 包含在 UINavigationController 中,而 UINavigationController 包含在 UITabBarController 中。

在代码中访问此父 UITabBarController 的最佳方式是什么?我想这样做,这样我就可以为它分配一个代表。当用户按下UITabBar 中的按钮时,我想在包含的UIViewController 中执行操作。

【问题讨论】:

    标签: ios swift uiviewcontroller uitabbarcontroller uitabbar


    【解决方案1】:

    self.navigationController?.tabBarController

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-02
      • 2012-06-15
      • 2014-11-03
      • 1970-01-01
      • 2015-05-15
      • 1970-01-01
      • 1970-01-01
      • 2018-02-04
      相关资源
      最近更新 更多