我正在使用 UITabBarController 编写 iPad 应用程序。目前它有两个按钮。当用户按下第一个按钮时,我会弹出一个表格 View 。当用户选择一行时,我切换到另一个 TableView 。问题是,当第二个表格 View 出现时,选项卡栏不再可见。我觉得我需要将第二个 TableView 添加为第一个 TableView 的 subview ,以免覆盖选项卡栏。救命!
最佳答案
当我要 sleep 时,我将做出一些假设,发布一个解决方案,希望对您有所帮助:)
首先,我相信你有一个
UINavigationController
-> UITabBarController
-> UITableViewController
堆栈。
现在,如果您将新 View 推送到堆栈上,会发生什么,它将使用堆栈顶部存在的 UINavigationController。所以你现在得到的是
UINavigationController
-> UITableViewController2
-> UITabBarController
-> UITableViewController
正如你所说,它隐藏了你的TabBar。您也不能使用模态视图,因为它将位于所有内容之上,并阻止所有其他 View 进行交互。
因此,您真正需要的是 UITabBarController 中的另一个 UINavigationController,如下所示
UINavigationController
-> UITabBarController
-> UINavigationController
-> UITableViewController
所以当你推第二个 View 时,你会得到这个
UINavigationController
-> UITabBarController
-> UINavigationController
-> UITableViewController2
-> UITableViewController
希望这对您有所帮助。
关于ios - iPad 上的表格 View 覆盖选项卡栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7474852/