Jake Walker
Jake Walker

Reputation: 305

Having problems with combined tab bar and navigation bar controllers

Problem with back button

I am having a problem with the back button not going to the previous view controller despite me using segues (via push). I think there is a problem since I saw this line on Apple's documentation saying

"An app that uses a tab bar controller can also use navigation controllers in one or more tabs. When combining these two types of view controller in the same user interface, the tab bar controller always acts as the wrapper for the navigation controllers."

But I want to be able to use a login screen which then moves onto a couple of screens before getting to a tab bar controller therefore not having the navigation bar wrapped in the tab bar controller. I know many popular apps use this, for example Instagram where you login then it shows the tab bar controller.

My current app layout is this;

Root navigation controller -> login -> meals (gif) -> tab controller (navigation controller for each tab (as per link) -> (My Rota/ My Meals/ Shopping List/ Item)

How to implement tab bar controller with navigation controller in right way

Upvotes: 1

Views: 618

Answers (1)

JingJingTao
JingJingTao

Reputation: 1790

It looks like it is behaving as expected, the back button is for your root navigation controller and when you use the 'back' button it pops your tab bar controller. I actually expected you to see two navigation bars, your root one and the one in the My Meals tab, unless you hide one.

You could hide the root navigation bar when you push the tab bar, but you'll probably need a button in each tab's navigation bar which pops the tab bar from the root navigational controller.

Beyowulf's suggestion of presenting it as a modal is another option.

Upvotes: 3

Related Questions