gpt4 book ai didi

ios - 如何在 AppDelegate 中获取 Storyboard UITabBarController 的指针

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:42:32 25 4
gpt4 key购买 nike

我正在使用 Storyboard来创建我的应用程序。我的应用程序的根是一个 UITabBarController。如何从我的 Application Delegate 中访问我的 tabBarController?我设法从我的一个 UIViewController 中成功地实现了操作。但我想将代码移至我的应用程序委托(delegate)。我怎样才能做到这一点?我以为我可以从 Storyboard 中拖放到我的应用程序委托(delegate)中,然后得到类似的东西

@property (nonatomic, strong) IBOutlet UITabBarController *tabBarController;

但这似乎不是目前的选择。

最佳答案

UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;

关于ios - 如何在 AppDelegate 中获取 Storyboard UITabBarController 的指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25318116/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com