【问题标题】:How to start app from specific TabbarController如何从特定的 TabbarController 启动应用程序
【发布时间】:2014-11-12 20:29:31
【问题描述】:

我有一个用于注册的 NavigationController,之后我将打开另一个具有主逻辑的 NavigationController。这是我的切换代码:

    NSString *containerName = @"MainContainer";
    UINavigationController *root = [[UIStoryboard storyboardWithName:@"Main" bundle:NULL] instantiateViewControllerWithIdentifier:containerName];

    UIWindow *wnd = [[[UIApplication sharedApplication] delegate] window];
    wnd.rootViewController = root;
    [wnd makeKeyAndVisible];

但现在我需要将 NavigationController 更改为 TabbarController。 如何开启标签栏?

编辑

之前:

UINavigationController(用于注册)

if (registration == success) 切换主逻辑 NavigationController

需要:

UINavigationController(用于注册)

如果(注册 == 成功)切换 TabbarController 与 (UINavigationController1, UINavigationControlle2)

【问题讨论】:

  • 把NavigationController改成TabbarController是什么意思?
  • 我已经编辑了我的问题。

标签: ios objective-c uinavigationcontroller uitabbarcontroller


【解决方案1】:

可以使用UITabBarController setViewControllers函数,参数是一个NSArray。

NSString *containerName = @"tabBar";
UITabBarController *root = [[UIStoryboard storyboardWithName:@"Main" bundle:NULL] instantiateViewControllerWithIdentifier:containerName];

UIWindow *wnd = [[[UIApplication sharedApplication] delegate] window];
wnd.rootViewController = root;
[wnd makeKeyAndVisible];

注册成功后,切换到标签为“tabBar”的tabBarController。

【讨论】:

  • 没有。看,我在 UINavigationControler 和 storyboardId(“Reg”),注册后我要去另一个导航控制器,我的问题中有代码。现在我需要继续使用 tabbarcontroller 而不是 navigationcontroller
  • 可以将tabBarController设置为Reg UINavigationController的rootViewController。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-05
  • 2011-03-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多