ios - iPad 上的表格 View 覆盖选项卡栏

标签 ios ipad uitabbarcontroller

我正在使用 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/

相关文章:

ios - 弹出 UIViewController 时奇怪的 Tabbar 动画

ios - PopToRootViewController 在 UITabBarController 中显示不平衡消息

ios - Cocos2d图像 mask

ios - 执行选择器 : didn't work properly when using dispatch_async and global_queue

ios - 如何录制音频并将其保存到 Sandbox?

iphone - 如何使用 KVC 设置 UILabel 属性,如文本颜色、字体等?

ios - 与关联值匹配的 Swift 枚举模式 - 无法调用函数

iphone - ios 更改默认应用程序语言

ios - 从后台线程调用时在 iPad 上延迟

ios - 选项卡栏为更多选项卡选择索引