How to link customized navigation bar to navigation controller? - ios

I created a normal view controller with a customized navigation bar. Later I changed my mind to embed the view controller into a navigation controller. And I noticed that embedding the view controller into a navigation controller will create another navigation bar!
As the image show:
I am wondering if there is a way to replace the navigation bar created by navigation controller with my own customized bar?
Or, if it's not possible, is there a way to configure the new navigation bar? Because for some reason it's not shown in my interface builder.

You have 2 solutions
Hide the system navigationbar using below code so it was display your custom navigation.
self.navController.navigationBarHidden = YES;
Customize the system navigation bar with its background color, back button and title text color. For this you can refer a below links which provide you detail of its
http://www.appcoda.com/customize-navigation-status-bar-ios-7/

You can change the color and buttons of the UINavigationBar provided by the system and make it look like yours.

Related

do I need to embed navigation controller if I want to make custom navigation bar view?

I need to make a custom navigation bar, since it will have search bar and some other views, it will be easier if I just make custom view instead of inserting view to navigation controller programatically
like the picture below, there are 2 ways to implement custom navigation bar view, by embedding navigation controller (yellow VCs) and use or just using present modally segue (blue VCs)
personally I will choose to use navigation controller because 'maybe' there are some methods that has already built that I can use. but the problem is, the custom navigation view (red color) in navigation controller it seems overlapped by the actual navigation bar in storyboard, I don't know how to hide the navigation bar from navigation controller in storyboard, even though if I use self.navigationController?.setNavigationBarHidden(true, animated: animated), it won't be a problem.
what is the right approach to make custom navigation bar like this?
In IB the navigation bar is shown only to simulate what it might look like when you run the app. The decision to show this is inferred, by default, by the fact that it is downstream from the navigation controller. Luckily you can change this option.

UINavigationBar without UINavigationControler Swift

I want to add a navigation bar to my view controller (I do not use a navigation controller) to show the page title and contain an add button. However when adding a navigation bar though the interface builder it is not showing. I am assuming it is possible to use it without a navigation controller otherwise there would be little point in allow me to drag it on to a view controller.

Navigation Bar on Modal View Controller

I have a view controller that executed by a modal view (no Navigation Controller connected). I want to have a Navigation Bar on top and be able to change the buttons and title dynamically depending on what the user has selected on the view controller.
I have read that you can set the View Controllers Simulated Metrics to include either a Translucent or Opaque Navigation Bar.
However, after I select this and add a navigation item to it, I can't get it to show the buttons or title and also don't know how to reference it in code.
Can anyone help walk me through it?
Simulated metrics are a design aid to help in laying out your views; the navigation bar you add that way isn't actually added to your controller at run time. You need to drag out a navigation bar from the object list, and add it to your controller's view.
Simulated Metrics is only to simulate, nothing is changed on your app. If you need a Navigation Bar create it programatically or drag out a navigation bar from the object list.

Navigation Bar appears under a large status bar when using TabBarController

When I added a TabBarController, the navigation bar of TestController appears under a large status bar (see screenshot). Am I missing a setting somewhere? Thanks.
Here it is not clear what do you want to do with navigation bar.If you want to just hide navigation bar,then hide it when you add navigation bar to tab bar controller or you can hide it seperately in each view controller.
UINavigationController *nav1=[[UINavigationController alloc]initWithRootViewController:vcPictureListing];
nav1.navigationBarHidden=TRUE;
or for doing it in each viewcontroller you can do it like
self.navigationController.navigationBar.hidden=TRUE;
This is just for hiding default one.If you want any navigation bar to be present then you can hide this default one and add imageview and button at top of viewcontroller and can have custom one
if you have added an image for naviagationbar then check you have not added shadow image for navigationbar. Check shadow image propery of navigationbar.

Hide Navigation Bar in Interface Builder w/ Storyboards

I have a pretty basic storyboard based app, with a UINavigationController, a main view and a secondary view, both of which are in the navigation hierarchy. I’m currently hiding the navigation bar on the main view by using setNavigationBarHidden: as appropriate in viewWillAppear and viewWillDisappear. It seems like there should be a way to do this in Interface Builder, rather than in code. Essentially I’d like the options available in the Simulated Metrics options, but not simulated. Does that exist?
In the scene for the UINavigationController itself, I suppose you could check the hidden button for the nav bar in the Attributes inspector, but that would make the nav bar hidden for all the view controllers in the navigation stack. But that's not what you want.
To hide the nav bar for an individual view controller using IB, you would need to use a stand alone nav bar for each view controller (e.g., drap and drop a Navigation Bar from the object library in IB). To use a stand alone nav bar in a navigation stack would be more work than programmatically hiding the nav bar.
Just uncheck the Attribute Inspector > Shows Navigation Bar in Attribute Inspector

Resources