UINavigation Controller Before Tab Bar Controller and After Tab Bar Controller? - ios

I have an application which starts with UINavigationController and contains a UITableViewController. In the UITableViewController on an event Tab Bar Controller is pushed which contains 5 View Controller each with one UINavigation Controller.
The NavigationController inside the Tab Bar is coming beneath the UINavigationController which is before the Tab bar.
Hierarchy of the application:
UINavigationController >
UITableViewController >
Tab Bar >
5 View Controllers each with UINavigationController >
View Controllers inside each ViewController above
I want the respective UINavigationController , Should replace the above UINavigationController ..

Apple's HIG recommends that you use the TabBarController on App level, I wouldn't risk to abuse it like that.
In general, use a tab bar to organize information at the app level. A tab bar is well suited for use in the main app view because it’s a good way to flatten your information hierarchy and provide access to several peer information categories or modes at one time.
https://developer.apple.com/Library/ios/documentation/UserExperience/Conceptual/MobileHIG/Bars.html#//apple_ref/doc/uid/TP40006556-CH12-SW52

Related

Navigation Bar and navigation items not visible on runtime

I don't understand why SignIn and SignUp navigation Bar and the back buttons are not visible even when embedding both of these views in the navigation controllers.
Is there anything else we have to do in code. All top bars are inferred in this case and I haven't touched the visibility of any.
There is no back button because there is nowhere to go back to. Your sign up and sign in view controllers are the root view controllers of their respective navigation controllers.
There is no visible title because what you are looking at is the navigation item of the tab bar controller, which has no title.
Your architecture posits a navigation controller insider a navigation controller, which is illegal:
nav controller -> tab bar controller -> nav controller
You can't do that.
Also you can't put a tab bar controller inside a navigation controller. A navigation interface inside a tabbed interface is fine (as illustrate in Apple's own docs: https://developer.apple.com/documentation/uikit/uinavigationcontroller). The reverse, a tabbed interface inside a navigation interface, is not.
The simplest solution is to eliminate the first navigation controller completely, as there is no need for it (you are not pushing anything onto it beyond its root view controller).
IN SIMPLE TERMS
Logically, your Tabbar should not be embedded in a UINavigation Controller. Instead, delete the NavigationController and make the Tabbar the root Viewcontroller then embed each UIViewcontroller in a separate Navigation controller

Set same navigation bar for UITabBarController child view controllers?

I have a storyboard that looks like this:
Structure:
UINavigationController -> UIViewController
UITabBarController |
UINavigationController -> UIViewController
I would like to apply the same navigation bar for both of the child view controllers of the UITabBarController.
I read on multiple pages in the internet that Apple strictly recommends not to embed a UITabBarController directly within a UINavigationController.
However, I have no idea how to get the same status bar for all of the underlaying controllers (I want all buttons to work the same on all controllers).
As said in the comments, I want both UINavigationControllers to look the same, I want them to navigate through the same controllers and I want to add custom buttons that function the same in every UINavigationController.
Here is a good example of what you wat
basically you can use
UINavigationBar.appearance()
To have the same UI for your navigation bar (or other elements) throughout the aplicaiton.

Using storyboard references with UINavigationController

I have the following hierarchy in my app: UITabBarController to many UINavigationControllers. Each navigation controller has a UIViewController.
I’ve split this up so that each UITabBarController’s child view controller is linked via a storyboard reference. In each of these references there’s a UINavigationController as the initial view controller.
Again some of these other storyboard references are split up too, where one of the UINavigationController’s child view controllers also uses a storyboard reference.
These UINavigationController’s child view controllers in the new storyboards do not carry across the UINavigationController style. Unlike the UITabBarController which does take across the UITabBarItem and shows them in the UINavigationController.
Is there anything I can do to see the navigation item of these UINavigationControllers so I can add bar button items in IB?
It's straight forward really; just go to Editor > Embed In > Navigation Controller and embed your view controller in a UINavigationController. You can then select the UIBarButton items under the Object Library in xCode, drag and drop them to the navigation bar on your View Controller and voila!
You can then delete the UINavigationController when done with adding the UIBarButton items to your VC; those bar button items will still be referenced and shown in the final product when you run it.
In Storyboard go to the Attributes Inspector for the Controller you wish to add the navigation bar and click on top bar drop down instead of it saying 'inferred' click on 'Translucent Navigation Bar'

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.

Gettings reference to existing navigation controller in tab bar after receiving remote notification

My app consists of following:
Tab bar controller with 5 tabs (this is my init controller)
each tab bar item has navigation controller and another view controllers further in
Now, I'm implementing skype-like chat (table view with contacts and chat as a detail view of this table view), which is currently residing in my second tab bar item, about 2 views deep in hierarchy.
When I receive remote notification, I want to preserve user navigation stack in all tabs, so instead of recreating tab bar in appdelegate, I just want to get reference of my navigation controller, that is in my second tab (so that I can modify it's navigation stack later on).
My problem here is, that I just can't get the reference. I got my tab bar like:
UITabBarController *myTabBar = (UITabBarController *)self.window.rootViewController;
but then I don't have any clue what to do. I will be happy for any suggestion.
The answer is (UINavigationController*)[myTabBar viewControllers][1] :)

Resources