ios - 从 StoryBoard 到 AppDelegate 引用 UITabBarController 的步骤

标签 ios objective-c uitabbarcontroller appdelegate

我使用的代码以编程方式在 appDelegate 中创建 UITabBarController。我已经拥有的是在 StoryBoard 中创建的 TabBarController。我想将我的 TabBarController(来自 Storyboard)引用到 appDelegate 并替换以编程方式创建的 UITabBarController。我该怎么做?

最佳答案

您可以使用下面的代码:

UIStoryboard *storyboard = [[UIStoryboard alloc] initWithStoryboard:[UIStoryboard storyboardWithName:@"YourStoryboardName" bundle:[NSBundle mainBundle]]];
UITabBarController *tabBarController = [storyboard instantiateViewControllerWithIdentifier:@"YourTabBarControllerIDInStroyboard"];

关于ios - 从 StoryBoard 到 AppDelegate 引用 UITabBarController 的步骤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34192796/

相关文章:

ios - 当我为 AFNetworking 设置我的 downloadProgressBlock 时,它只会在最后调用一次

c# - Xamarin表单-C#-异步和等待不起作用?

ios - 无法将文件的所有者连接到 View

objective-c - 方法 'documentation'

iphone - Objective-C - 获取 CTFont 的名称?

objective-c - 重写的 getter 不会触发其他选择器

swift - 如何使用 tabbarcontroller 通过弹出窗口的展开转场导航到 View

iphone - "_OBJC_CLASS_$_GDataOAuthAuthentication",引用自 :

ios - 在当前 View Controller 具有 UITabBar 但没有 UITabBarController 时呈现 View Controller

iphone - UITabBar 中的单个选项卡不包含 UINavigationBar