导航控制器内的标签栏控制器,如何将新的viewcontrollers推送到tabcontroller? [英] Tab bar controller inside a navigation controller, how to push new viewcontrollers to the tabcontroller?

查看:87
本文介绍了导航控制器内的标签栏控制器,如何将新的viewcontrollers推送到tabcontroller?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设计要求:


  1. 显示用户可以选择的项目列表

  2. 之后选择了一个项目后,用一个后退按钮将用户带到一个新视图。新视图应包含底部不显示在第一个屏幕中的选项卡列表

  3. 单击选项卡中的项目时,应显示带有后退按钮的新屏幕标签应该仍然可以在底部看到。

  4. 单击选项卡应该让用户将层次结构备份到#2。不到第一个屏幕。

  1. Show a list of items the user can pick from
  2. After having picked an item, bring the user to a new view with a back button. The new view should contain a list of tabs at the bottom that are not present in the first screen
  3. When clicking an item in the tabs, a new screen should appear with a back button and the tabs should still be visible at the bottom.
  4. Clicking a tab should take the user back up the hierarchy to #2. Not to the first screen.

我试过以下结构:

  • UINavigationController
  • UIViewController with a UITableView
  • UIViewController with a UITabBar (like here http://www.wiredbob.com/2009/04/iphone-tweetie-style-navigation.html)

以及


  • UINavigationController

  • UIViewController 使用 UITableView

  • UITabbarController

  • UINavigationController
  • UIViewController with a UITableView
  • UITabbarController

这两种情况都可以正常显示 UITabBar ,但是当我点击其中一个标签中的某个项目并推送一个新的 UIViewController ,然后底部的标签消失。我希望选项卡保留在 UITabBarController 的选项卡内的所有推送 UIViewControllers

Both cases work fine with displaying the UITabBar, but when I click an item in one of the tabs and push a new UIViewController, then the tabs at the bottom disappears. I want the tabs to remain in place for all pushed UIViewControllers that occurs inside a tab of the UITabBarController.

一个相关的问题就是这个问题,但它没有处理选项卡中推送的viewcontrollers问题:
导航控制器内的导杆控制器,或共享导航根查看

A related question is this one but it doesn't deal with the problem of pushed viewcontrollers inside a tab: Tab bar controller inside a navigation controller, or sharing a navigation root view

我是否需要将root控制器更改为 UITabController ?有人实际实现了吗?

Do I need to change the rootcontroller to the UITabController? Anyone actually implemented this?

推荐答案

这是正确的结构:

UITabBarcontroller (UIWindow's rootViewController)
->UINavigationController (first tab)
-->UIViewController
->UINavigationController (second tab)
-->UIViewController

这篇关于导航控制器内的标签栏控制器,如何将新的viewcontrollers推送到tabcontroller?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆