【问题标题】:How to add tabs to UINavigationController如何将选项卡添加到 UINavigationController
【发布时间】:2012-01-11 20:46:44
【问题描述】:

我还是 iPhone 应用的新手。开发。 ,我使用 uiNavigationController 创建基于导航的应用程序,问题是当我选择导航控制器并将底部栏设置为选项卡时,没有选项卡出现,当我添加 uitabcontroller 时也没有出现选项卡。

如何使用 mainwindow.xib 向 UINavigationController 添加选项卡?链接、教程或任何建议?

【问题讨论】:

    标签: iphone objective-c


    【解决方案1】:

    下面是一个示例代码,用于创建一个带有两个控制器作为选项卡的 tabBarController:

    myTabBarController = [[UITabBarController alloc] init];
    NewsFeedController * newsFeedController = [[NewsFeedController alloc] initWithFacebook:facebook];
    UINavigationController * navigationControllerHome = [[UINavigationController alloc] initWithRootViewController:newsFeedController];
    [newsFeedController release];
    AboutController * aboutController = [[AboutController alloc] init];
    UINavigationController * navigationControllerAbout = [[UINavigationController alloc] initWithRootViewController:aboutController];
    [aboutController release];
    myTabBarController.viewControllers = [NSArray arrayWithObjects:navigationControllerHome, navigationControllerAbout, nil];
    [self.window addSubview:myTabBarController.view];
    

    【讨论】:

      猜你喜欢
      • 2019-12-12
      • 2011-11-11
      • 1970-01-01
      • 1970-01-01
      • 2021-10-23
      • 1970-01-01
      • 2014-05-27
      • 1970-01-01
      • 2020-12-03
      相关资源
      最近更新 更多