我有一个像下面层次结构的堆栈(我使用编程方式,所以我做到了)
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/