How to maintain UITabBar with segue - ios

So, I have an hierarchy which is(see image for better understanding): Navigation Controller -> Tab Bar Controller -> VC1,2,3,4,5
All good, all working.
Now, if I segue from one those VCs I lose my Tab Bar. Which I believe it is weird, since they all have a connection to the Tab Bar Controller VC.
Any way I can maintain it?
Thanks

you should not add UITabBarController inside UINavigationController, but you should add each UIViewController managed by UITabBarController inside a UINavigationController
like the following image

Related

Different navigation item for each view in tab bar controller

The Problem
I'm relatively new to Swift and I'm trying to build an application that makes use of a UITabBarController.
What I'm trying to do is put a different navigation bar (or UINavigationItem) on each of the tabs in the UITabBarController.
For example, I want the UINavigationItem I set, with its bar button items, to appear on MyViewController instead of a back button to the previous view controller, such as shown on the image below.
The current layout on the Storyboard is as follows.
MyViewController on the sidebar:
What I've Tried
Someone suggested that I should embed each UIViewController (e.g. MyViewController) in a Navigation Controller. I've tried this and it doesn't work.
I've also tried to set the Top Bar to "None" in the Attributes tab of the options menu.
Thank you in advance for your help.
Here is how i did it,
UINavigationController -> UITabbarController
And then each "Tab" is in different Storyboard and every storyboard start with a "Navigation Controller". So yes every tab in different navigation controller this how you should do it.
Different storyboards because may be multiple people work on storyboard at same time.
Why TabbarController inside Navigationcontroller ?
I put the "TabbarController" inside "NavigationController" because some of the controllers i want them to be full screen, like hiding the "Tabbar" so for that i push them from main NavigationController.
//Out of context but may help you,
I have created an "Extension" of Navigation Controller to push a view controller on main navigation so that any of the tabbars (which are also inside navigation controllers) can easily use the extension to push any view controller if want to hide the tabbar.

Content under the navigation bar when connect my view to a UITabBarController

I added a UITabBarController, then manually I added a navigation bar to the UITabBarController, so my UITabBarController looks like this:
Then I drag a segue from my UITabBarController to two UITableViewController.
My problem is that in my UITableViewController when I load data, the data comes behide the navigation bar, not under it.
What do I do wrong ?
Your view should be embed in navigation controller first then u embed that navigation controller with tabbar controller then it should work fine

Going from NavigationController to TabBarController

So... I've got a ViewController that's being pushed onto a NavigationController. In interface builder I create a separate ViewController and Embed it into a TabBarController and it looks good in Interface Builder.
In my app, I'm trying to go from one of the ViewControllers in my NavigationView to the ViewController in the TabBarController. How would I do this the correct way? I can't just push the view onto the NavigationController, because the tab bar at the bottom won't show up.
Any help would be greatly appreciate.
I believe you're operating with the UINavigationController and UITabBarController in a backwards order to recommended best-practice.
Unless something has changed in the last year or two (which may have happened) the UINavigationController should never have a UITabBarController pushed onto it. If you are using a UITabBarController in your app, it should be the window.rootViewController, and the navigation controller being member of the UITabBarController's viewControllers array.
I'm trying to go from one of the ViewControllers in my NavigationView
to the ViewController in the TabBarController. How would I do this the
correct way?
In that structure, you'd assign your destination view controller as another element of the viewControllers array. Then, in my style, I'd send a NSNotification something like "LaunchOtherViewController" from your first view controller, and thus you have no need for the first view controller to know about the tab bar controller or second view controller. Then have some class that knows about the second view controller receive that notification, and update the selectedIndex of the UITabBarController to that of the second, destination view controller.
Hope that makes sense.
You need to push the TabBarController onto the view. You may need to set the selected view controller of the tab bar, but it's important the tab bar controller be actually pushed onto the navigation stack (or presented modally).

iOS Storyboards - Re-use UIViewController

I've got the following structure setup in my Storyboard.
I've got a TabViewController (circled in red) that shows a UIViewController via one of its tabs by doing a push (circled in blue).
I want to re-use that UIViewController from the TabViewController. I'd like to 'push' it but I don't really have a navigation controller so I may end up displaying it as a modal.
However, I'm not sure how to handle navigation back to the TabViewController since in this case there's no navigation bar. Any suggestions on the best way to handle this?
EDIT
Is there a way to insert a Navigation controller when its displayed directly from the TabViewController?
Why don't you put your view hierarchy like this:
UITabBarController -> UINavigationController -> BlueViewController
This UINavigationController should be put in the viewControllers property of the UITabBarController instance. If you do this, you can push and pop as many view controller as you want and you can also hide the navigation bar if needed.
Cancel button whose action is [self dismissViewControllerAnimated:YES completion:nil];

Moving from a view controller to a tab bar controller when using storyboards ioS5

I created a tab bar controller in a story board which is working perfect. Now i need to move from a view controller to this tab bar controller. I do not have a separate class for the tab bar controller. However I tried creating a class for this tab bar controller but when i call it/initialise it, it just gives a new tab bar instead of whats on the storyboard. Ive been stuck with this for a while now so any help would be appreciated. So application works this way. viewcontroller1 -> viewcontroller2 -> tabbarcontroller (which has a table view and a map view)
If I understand your question correctly, what you want to do is assign an identifier to the TabBarController in the Storyboard, in the Attributes Inspector, and then use that to programmatically instantiate the controller using this code:
UITabBarController *tabBarController = [self.storyboard instantiateViewControllerWithIdentifier:#"TabBarIdentifer"];

Resources