UINavigationItem of ChildviewController - ios

I have Base Controller and Child View Controllers. I want to create UINvaigationItem in Base Controller in storyboard, to make Child controllers inherit it, and show. I create this UINavigationItem in storyboard for Base Controller. Child Controllers not showing this UINavigationItem from Base controller, and it's properties are all nil. How can i make UINavigationItem from BaseController be in ChildViewControllers?
This is picture of storyboard, on the left is Base Controller, on the right is Child ViewControllers.

Basically you can't un-inherit the UINavigation in ChildViewController because it is part of the views stack in the UINavigation, but you can call
// hide navigation bar
self.navigationController.navigationBarHidden = YES;
This will hide the navigation bar on the ChildViewController
You can use the pop methods in the ChildViewController to programmatically control the navigation stack
EDIT
Base on your photo i see you haven't connected all the ViewControlleres in the storyBoard to the navigationViewController.
I recommend not creating the UIViewController like you did.
1) simply add & connect the view controllers you wish to be in the navigation stack
2) select them and in Xcode menu go to Editor->Embed in-> Navigation Controller
That way, all the views will be included in the navigation stack and have a reference to the UINavigationViewController

Related

How to connect a Navigation Controller in one storyboard to View Controllers in another storyboard?

Here is my Navigation controller that has one View Controller in the stack, but I have another storyboard with Viewcontrollers I want to add to the stack. I have the Views separated in order to better organize my Views and to have less views per Storyboard. How do I add Views from the referenced storyboard to the Navigation controller shown?
Right now I have the reference pointing to another Navigation controller in the second storyboard, but I wouldn't have a back arrow to the viewcontroller in the first Navigation Controller.
In the Storyboard A where you have a navigation controller add a Segue to Storyboard B (Settings) and make sure that you also write the View controller ID (MyViewControler) that you like from within Storyboard B in the Referenced ID
in Storyboard B (Settings) add a navigation controller and set the root view controller to the one that you like (MyViewControler) this navigation will be use only show the UI as it will be in the navigation controller from Storyboard A and will not be part of the navigation stack, This is because you add Referenced ID !!!

Why does embedding a View Controller in a Navigation Controller, then in a Tab Bar Controller attach the nav bar to the Tab Bar Controller?

Back when I first created the foundational layout for the app I'm currently working on in Storyboard, I did it in two steps:
Selected my View Controller and used Editor->Embed In->Navigation Controller.
Selected my View Controller again and used Editor->Embed In->Tab Bar Controller.
This was the resulting layout:
Question 1: Why do these steps create such an odd layout?
In this weird layout that seems to imply that the Navigation Controller is attached to the Tab Bar Controller as its parent, the only way I can get navigation items to display in the app (in the view controlled by the View Controller on the right) is by placing them in the nav bar of the Tab Bar Controller scene.
However, this creates various issues, including not being able to create an IBOutlet in my View Controller file for a custom view I drag into the title view slot in the Tab Bar Controller scene. Meanwhile, dragging anything into the navigation bar in the View Controller scene just makes it not appear in the app when it runs.
Question 2: How can I fix this layout so that I can control-drag from navigation items into my View Controller file? Or is everything actually correct, and I'm just trying to force something I shouldn't? (My intention here is to be able to set the custom title view's text in my View Controller code.)
Its obvious, if you want to embed MyViewController to NavigationController then you need to change your second step and need to embed NavigationController to Tab Bar Controller.
Selected MyViewController and used Editor->Embed In->Navigation Controller.
Selected NavigationController Embed with MyViewController and used Editor->Embed In->Tab Bar Controller.
It should look like this.
Note: You need to embed MyViewController to navigationController only if you want to perform push operation on this TabBarItem means with MyViewController other wise simply embed MyViewController to TabBarController no need to embed it with NavigationController.

Navigation Bar not showing in embed Navigation Controller

I'm trying to display the navigation bar at the top of the screen, but it's not showing in embed navigation controller.
Here is how it is in the storyboard:
And here it's in the simulator:
As you can see, I created a custom TabBar (following this tutorial) at the bottom of the screen so I can navigate between the different views.
I believe that I'm going to have to load the navbar programatically because the only solution that I found was to set the navigation controller as the initial view controller, but I already set another view as the initial one so I can't do that.
Issue :
When you instantiate a viewController using storyBoard identifier they wont come with free embedded navigation controller, even if you have added a NavigationController to them. As a result you are adding a viewController without navigation bar to your tab bar VC.
Solutions:
Solution1: If you want each child viewControllers to carry their own navigation controller hence their own navigation stack, provide a storyboard identifier to Navigation Controller behind your child viewControllers and instantiate the Navigation controller itself rather than ViewController. And add NavigationController as you tab bar looking VC's child. Because navigation controller loads the embdedded VC by default you will see your child VC with nav bar.
Solution2: All that you care for is only nav bar than add the Navigation Controller behind the VC containing tab bar looking View.
Hope it helps
Have you tried constraining the navigation bar to your view? Otherwise it can move offscreen.
You need to point the tab bar controller segue to the navigation controller of your view - otherwise if you point the segue straight to the view you're just loading the view without any navigation controller attached.

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'

How to custom in storyboard my view controller's UINavigationItem that is instantiated by identifier and pushed onto navigation stack?

In storyboard I have UINavigationController with some controllers.
Within the last one I have a button Button. When I tap that button I instantiate another view controller from current storyboard:
But here I would like to custom my UINavigationItem with my custom UIBarButtonItems. How to do this here in storyboard?
Change Top Bar metrics for view controller:

Resources