Goktug Goktug - 5 months ago 26
iOS Question

Navigation Controller, Navigation Item and Navigation Bar

I have a view controller. I choose Editor->Embed In->Navigation Controller option. A navigation controller is added to storyboard and my view controller becomes root view controller. Besides, A Navigation Item is added at the top of my view controller.

On the other hand, we can put a navigation bar on view controllers and we can create forward backward transition between view controllers without navigation controller.

What is difference between navigation item and navigation bar ?

Answer Source

The navigation item manages the buttons (left and right) and views (mainly the title view) to be displayed in a navigation bar. Each navigation item points to a specific view controller.

The navigation bar is the container for the navigation item and mainly handles layout, transitions and animations.

You can read more about them in the official docs:

https://developer.apple.com/documentation/uikit/uinavigationitem

https://developer.apple.com/documentation/uikit/uinavigationbar