IOS Introduction
Swift UI Label
Swift UI Button
Swift UI Text Field
Swift UI Slider
Swift UI Switch
Swift UI Stepper
Swift UI Date Picker
Swift UI Segmented Control
Table View
Collection Views
iOS Content View
iOS View Controllers
iOS Bar interface
iOS Navigation interface
iOS Architect Pattern
iOS Libraries
iOS Web request and parsing
iOS user defaults
iOS Coredata and database

Navigation Item

Navigation Item

Navigating to different view controllers within iOS applications is made possible by Navigation Items, presented in a navigation bar. UINavigationItem inherits NSObject and is an instance of that class.

An UINavigationItem object containing the buttons and views that will appear in the view controller's navigation bar is passed to it when pushed to the top of the navigation stack. While every view controller in the navigation stack has a similar navigation bar, each view controller's navigation item object is unique.

As soon as you click on a navigation item object, you'll get information about its view controller. This includes the title of the view controller that's at the top. Depending on the view controller, the navigation bar may have one or more right buttons that allow the user to perform certain activities. The leftBarButtonItems and rightBarButtonItems properties of the UINavigationItem are used to define the left and right bar button items, respectively. In the navigation bar, the appearance of these elements is always determined by how much space is available.

When a navigation item's backBarButtonItem property is set to true, the back button moved to the previous view controller will look like this. The back bar button is not displayed when the View Controller is the Root View Controller.

When the UIBarButtonItem class is initialized, the navigation item's left and right bar button items are created.