Agung
Agung

Reputation: 13843

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)

enter image description here

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?

Upvotes: 1

Views: 35

Answers (1)

Ken Boreham
Ken Boreham

Reputation: 904

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.

enter image description here

Upvotes: 1

Related Questions