简体   繁体   English

带标签栏控制器的导航控制器?

[英]Navigation controller with tab bar controller?

I have a tableViewController embedded in my tab bar controller. 我有一个嵌入在我的标签栏控制器中的tableViewController。 When a cell is tapped, a segue is launched to another view controller to show the details of that object. 当点击一个单元格时,会向另一个视图控制器启动一个segue以显示该对象的详细信息。 However, the Back button is not appearing in the viewDetail. 但是,后退按钮不会出现在viewDetail中。 I tried embedding the view into a separate Navigation Controller but that didn't change anything. 我尝试将视图嵌入到单独的导航控制器中,但这并没有改变任何东西。 What am I doing wrong? 我究竟做错了什么? I currently have Tab Bar Controller -> tableView -> Navigation Controller -> viewDetail (need Back button here to return to tableView). 我目前有Tab Bar Controller - > tableView - > Navigation Controller - > viewDetail(这里需要Back按钮返回tableView)。

Here's what I have right now: 这就是我现在所拥有的:

在此输入图像描述

Thanks!! 谢谢!!

Each UIViewController in UITabBarController could be embedded in an UINavigationController at your convenience, that way you'll be able to use all of the features that you need. UITabBarController每个UIViewController都可以在您方便时嵌入到UINavigationController中,这样您就可以使用所需的所有功能。

Basically, you need to select the tableViewController, click on Editor menu item, select Embed in and click on Navigation Controller , ta daa. 基本上,您需要选择tableViewController,单击Editor菜单项,选择Embed in并单击Navigation Controller ,ta daa。

UINavigationController示例

You can show or hide Navigation Bar if you need it using Interface Builder or programmatically in your Detail viewController as follows: 如果需要使用Interface Builder或在Detail viewController中以编程方式显示Navigation Bar可以显示或隐藏Navigation Bar ,如下所示:

override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationController?.navigationBarHidden = true
    // Do stuff
}

Set NavigationController to TabBarController, then set NavigationController's rootViewController to TableViewController. 将NavigationController设置为TabBarController,然后将NavigationController的rootViewController设置为TableViewController。

在此输入图像描述

You just have the organization wrong. 你只是让组织错了。 Currently you have Tab Bar Controller -> tableView -> Navigation Controller -> viewDetail. 目前你有Tab Bar Controller - > tableView - > Navigation Controller - > viewDetail。 It should be Tab Bar -> tableview -> View detail. 它应该是Tab Bar - > tableview - >查看详细信息。 Navigation should be separate pointing to table view. 导航应该分开指向表视图。 Nothing should be pointing to navigation. 什么都不应该指向导航。 It should just point to tableview 它应该指向tableview

在此输入图像描述

It should look something like the above picture 它应该看起来像上面的图片

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM