简体   繁体   中英

Navigation controller with tab bar controller?

I have a tableViewController embedded in my tab bar controller. When a cell is tapped, a segue is launched to another view controller to show the details of that object. However, the Back button is not appearing in the 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).

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.

Basically, you need to select the tableViewController, click on Editor menu item, select Embed in and click on 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:

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

Set NavigationController to TabBarController, then set NavigationController's rootViewController to TableViewController.

在此输入图像描述

You just have the organization wrong. Currently you have Tab Bar Controller -> tableView -> Navigation Controller -> viewDetail. It should be Tab Bar -> tableview -> View detail. Navigation should be separate pointing to table view. Nothing should be pointing to navigation. It should just point to tableview

在此输入图像描述

It should look something like the above picture

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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