【问题标题】:Pushing a UITabBarController with a UINavigationBar onto an existing UINavigationBar将带有 UINavigationBar 的 UITabBarController 推送到现有的 UINavigationBar
【发布时间】:2011-05-04 05:59:59
【问题描述】:

好的,我正在做一个小组项目,我们要做的是创建一个“结果屏幕”,它有它自己的 UINavigation 并在其中包含两个 TabBar。我们正在尝试将其推送到现有 UINavigation 之上。现在在这段代码的那一刻。我们有我们的主 App Delegate,我们在其中实例化了一个开始导航和标签栏。

startTabBarController.viewControllers=[NSArray arrayWithObjects:templatesVC,recentJobsVC,profileVC,aboutVC,nil]; 

 startTabBarController.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"D2P_Logo2.png"]];
 startTabBarController.navigationItem.titleView.backgroundColor = [UIColor clearColor];
 UIBarButtonItem *tempRightBarButton = [[UIBarButtonItem alloc] initWithTitle:@"New" 
                     style:UIBarButtonItemStylePlain 
                    target:self 
                    action:@selector(makeJob)]; 
 [startTabBarController.navigationItem setRightBarButtonItem:tempRightBarButton];

 [mainNavBar pushViewController:startTabBarController animated:NO];

 [window addSubview:mainNavBar.view];

现在我们要做的是在顶部添加另一个带有分段导航控制器和标签栏控制器的标签栏。

目前正在尝试使用没有 xib 的 UIViewController 来执行此操作。我尝试了各种方法,但出现的只是一个空白屏幕。

就我们拥有的布局而言,我们有一个导航控制器,它的堆栈上是一个 UITabBarController -> UITableViewController -> UITableViewController,我们希望在其中添加一个带有 UINavigationController 和 UITabBarController 的 UIViewController。

任何建议将不胜感激。提前致谢。

【问题讨论】:

  • 欢迎来到 SO - 这似乎是您的第一个问题?只是一个提示 - 编辑器提供“代码”标签以使您的代码更易于阅读。它甚至包括自动语法突出显示。我可以建议您编辑这篇文章并尝试一下吗?

标签: iphone ios uiviewcontroller uinavigationcontroller uitabbarcontroller


【解决方案1】:

没关系,我找到了解决方案。最后使用了 ModelViewController,然后遇到了一些白条问题,我通过搜索这些论坛解决了这个问题,发现我只需要在显示 ModelViewController 并在加载后显示它之前隐藏状态栏。

不过还是谢谢。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-13
    • 2012-09-28
    • 2012-01-30
    • 1970-01-01
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多