【问题标题】:Navigation Controllers in tab bar controller标签栏控制器中的导航控制器
【发布时间】:2011-05-13 23:07:52
【问题描述】:

带有标签栏的应用程序的逻辑或视图结构是什么,例如3 个不同的选项卡。每个选项卡在选项卡视图控制器选项卡内都有一个导航控制器?

导航控制器在哪里创建和管理?

【问题讨论】:

    标签: iphone ios uinavigationcontroller uitabbarcontroller


    【解决方案1】:

    如果您使用的是 NIB 文件,则可以直接在主 NIB 中设置应用的结构。结构如下:

    • UITabViewController
      • UINavigationViewController
        • TabBarItem
        • UIViewController(设置为从 Tab 1 View.nib 加载)
          • NavigationItem(用于选项卡 1 的导航控制器的根视图)
      • UINavigationViewController
        • TabBarItem
        • UIViewController(设置为从 Tab 2 View.nib 加载)
          • 导航项
      • UINavigationViewController
        • TabBarItem
        • UIViewController(设置为从 Tab 3 View.nib 加载)
          • 导航项

    【讨论】:

    • 谢谢。如果 tableview 需要在其中一个 navigationItems 中怎么办? So a tableview is in one of the tabs and when a cell is selected the navigation controller for the tab pushes another view, that the user can return to the tableview from using the navigationcontroller?
    • 您可以用 UITableViewController 替换上面相应的 UIViewController(或者只是将您的 UIViewController 的视图设置为 UITableView 等)在您的 tableView:willSelectRowAtIndexPath: 方法中:a)创建一个您想要导航的视图控制器b) 这样做:[ self.navigationController pushViewController:<next view controller> animated:YES ]
    【解决方案2】:

    这也让我发疯了,所以一旦我开始工作,我就添加了这个:

    https://github.com/benbruscella/iPhone-TabBarController-With-NavigationController

    希望这会对某人有所帮助。

    【讨论】:

      【解决方案3】:

      您可以从主 xib 设置导航控制器,您可以设置要上传到该导航控制器的类......

      【讨论】:

        猜你喜欢
        • 2017-05-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-11-08
        • 1970-01-01
        • 2011-09-18
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多