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!!
A tab bar controller is a powerful UI component for iOS apps. It's a container view, and you use it to group view controllers together. They give your app's user access to the most important screens of your app.
Open Main. storyboard and select the map view controller. From Xcode's Editor menu, choose Embed In → Tab Bar Controller. This will add the map view controller to the view controllers array of a new tab bar controller.
NavController manages app navigation within a NavHost . Apps will generally obtain a controller directly from a host, or by using one of the utility methods on the Navigation class rather than create a controller directly. Navigation flows and destinations are determined by the navigation graph owned by the controller.
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.
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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With