ios - 将 UITabbarController 放入 UINavigationController 中。可能会出现什么问题?

标签 ios swift

我有一个像下面层次结构的堆栈(我使用编程方式,所以我做到了)

UINavigationController -> UITabbarController -> UInavigationController -> UIViewController
                                             -> UInavigationController -> UIViewController

正如 Apple Docs 对 pushViewController 所说:

The view controller to push onto the stack. This object cannot be a tab bar controller

我需要知道这是否有已知错误或肯定会导致错误。

我确实搜索了很多类似的帖子,但没有一个给我可以接受的答案。 Using UITabBarController with UINavigationController - Swift 3

Can you push a UITabBarController inside an UINavigationController

最佳答案


来自 Apple :

Before creating a tab bar interface, you need to decide how you intend to use a tab bar interface. Because it imposes an overarching organization on your data,you should use one only in these specific ways:

  • Install it directly as a window’s root view controller.
  • Install it as one of the two view controllers in a split view interface. (iPad only)
  • Present it modally from another view controller.
  • Display it from a popover. (iPad only)

Installing a tab bar interface in your app’s main window is by far the most common way to use it. In such a scenario, the tab bar interface provides the fundamental organizing principle for your app’s data, with each tab leading the user to a distinct part of the app. You can use tab bar controllers by themselves or in conjunction with other view controllers to create even more sophisticated interfaces. For more information, see Combined View Controller Interfaces.

It is also possible to present a tab bar controller modally if a very specific need makes doing so worthwhile. For example, you could present a tab bar controller modally in order to edit some complex data set that had several distinct sets of options. Because a modal view fills all or most of the screen (depending on the device), the presence of the tab bar would simply reflect the choices available for viewing or editing the modally presented data. Avoid using a tab bar in this way if a simpler design approach is available.

关于ios - 将 UITabbarController 放入 UINavigationController 中。可能会出现什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54865547/

相关文章:

iOS 10 UNNotificationAction 从后台打开应用

ios - ADAL iOS 重定向 URI 必须是 http(s)?

ios - swift 自定义 .framework 找不到协议(protocol)

xcode - 当尝试动态创建的 UILabel 进行换行时,文本消失

swift - SecTransform 的缓冲输入

ios - Swift + Firebase - 检查具有 autoId 的节点的值是否存在

ios - 在 Swift 中将变量传递回父级

ios - 在不遵守 iPhone 铃声/静音开关的情况下在后台播放声音

ios - 使用带有添加的 WebAPI 参数的 NSDictionary

iphone - 在核心图折线图中旋转数据标签