Uinavigationcontrolle
Uinavigationcontroller: Navigation controller, one of the most commonly used multi-view controllers in iOS, is used to manage multiple view controllers. Also known as a multi-view controller.
The navigation controller can be considered as the controller of the management controller, which mainly manages the controller with hierarchical relationship.
Create:
Uinavigationcontroller inherits from the Uiviewcontroller, manages the control view controller in the form of the stack, must have at least 1 managed view Controller, this controller we call, the navigation controller's root view controller. Any class that inherits from Uiviewcontroller (polymorphic) can be used as the root controller.
Working principle:
The Uinavigationcontroller manages the switch of the controller through the stack, controls the stack and the stack to show the various view controllers.
Uinavigationcontroller's Contentview always shows the view of the top controller. The Viewcontrollers property stores all managed controllers in the stack
The Navigationcontroller property, the attributes in the parent class, and each controller in the stack, can pass this property to get the Uinavigationcontroller object that you are in.
into the stack and out of the stack
pushviewcontroller:animated//Enter the following view controller
Popviewcontrolleranimated://Return to previous view controller
poptoviewcontroller:animated//Return to the specified view controller
poptorootviewcontrolleranimated//Return to the root view controller
Uinavigationcontrolle Common Properties:
Viewcontrollers//All controllers in the stack
Topviewcontroller//Controller at the top of the stack
Visibleviewcontroller//Controller currently being displayed
Navigationbar//navigation bar
Custom Uinavigationbar
navigationbar-navigation Bar, iOS7 after the default is transparent, iOS7 before the default is opaque.
Navigationbar in the case of transparency, a portion of the area is coincident with the Contentview. Navigationbar in the case of opacity, Contentview follows Navigationbar.
Navigationbar Vertical screen under the default height of 44, horizontal screen under the default height of 32.
Custom Navigationbar
Bartintcolor//Set the color of the navigation bar
Setbackgroundimage:forbarmetrics://navigation bar plus background image
Management Uinavigationitem
Uinavigationbar manages a set of Uinavigationitem in addition to defining its own style.
Similar to Uinavigationcontroller, Uinavigationbar also manages a set of Uinavigationitem in the form of stacks. Provides push and pop operations item.
Each view controller has a Navigationitem property. The left button, right button, caption, etc. set in Navigationitem will be displayed on the Navigationbar as the controller is displayed.
Uinavigationitem
Uinavigationitem belongs to M in MVC. Encapsulates the data to be displayed on the Uinavigationbar.
Title//Caption
Titleview//Title View
Leftbarbuttonitem//Left button
Rightbarbuttonitem//Right button
Uibarbuttonitem
Uibarbuttonitem belongs to the MVC m. Defines the trigger event, appearance, etc. of the button on the Uinavigationitem
-initwithbarbuttonsystemitem:target:action:
-initwithtitle:style:target:action:
-initwithimage:style:target:action:
Tintcolor
Inter-Interface Transfer value
Property pass-through value
Proxy pass-through value
Uinavigationcontroller manages the view controller in the form of a stack.
Uinavigationbar manages a set of uinavigationitem,uinavigationitem containing uibarbuttonitem through push and pop control jumps.
Using attribute pass-through values to solve the problem of previous value passing
Using delegate to solve the problem of passing values from backward to forward
UI Basics: Uinavigationcontroller, interface communication