故事板:带有选项卡式视图层次结构的统一导航栏

时间:2013-11-09 10:07:37

标签: ios xcode storyboard uitabbarcontroller uinavigationbar

我有这个视图层次结构:

UINavigationColtroller
-> UITableViewController
   -> (push) UITabBarController
      -> (tab) UITableViewController [list view]
         -> (push) UIViewController [detail view]
      -> (tab) UITableViewController
         -> (push) UIViewController
      -> (tab) UITableViewController
         -> (push) UIViewController

问题是导航栏自定义不适用于底部3个视图控制器。这有点意义,因为有一个堆栈的导航项目3个标签视图在同一级别上。

所以我选择了这个替代方案:

UINavigationColtroller
-> UITableViewController (1)
   -> (modal) UITabBarController
      -> (tab) UINavigationColtroller (2)
         -> (root) UITableViewController
            -> (push) UIViewController
      -> (tab) UINavigationColtroller (3)
         -> (root) UITableViewController
            -> (push) UIViewController
      -> (tab) UINavigationColtroller (4)
         -> (root) UITableViewController
            -> (push) UIViewController

这很糟糕,因为现在有四个独立的导航堆栈。不仅故事板变得丑陋,我还在#2添加了额外的样板,#3#4连接左按钮以手动返回#1

即使中间有标签栏,有没有办法只使用一个顶级导航堆栈来维护导航?

1 个答案:

答案 0 :(得分:0)

我认为你可以提前

UITabBarController (Replace with UINavigationColtroller)
-> UINavigationColtroller (RW UITableViewController)
   -> (With hidden Tabbar) UITableViewController  (RW UITabBarController)
        ->  (push and show Tabbar) UITableViewController [list view]
        ->  (push and show Tabbar) UIViewController [detail view]
        ->  (push and show Tabbar) UITableViewController
        ->  (push and show Tabbar) UIViewController
        ->  (push and show Tabbar) UITableViewController
        ->  (push and show Tabbar) UIViewController