First, the navigation controller basic use
Multi-Controller
Navigation Controller
Simple use of the navigation controller
1. Create an empty project
2. Create a navigation controller Nav
3. Set the navigation controller to the window's root controller
4. New 3 Controller Classes manage these 3 view (tick also create Xib)
Add a label to the Xib to indicate the number of controllers, add a button to jump to the next controller
5. Create a first controller and add it to the navigation controller
[Nav Pushviewcontroller:one Animated:yes];
6. Listen for a button to jump to the second and implement the method
-(Ibaction) Jump2two: (ID) sender{
1. Create a second controller
2. Add a second controller to the navigation controller
As long as the current controller is a sub-controller of the navigation controller, this property can be obtained directly to the navigation controller where the current controller is located
[Self.navigationcontroller Pushviewcontroller:two Animated:yes];
}
7. Listen to the button on the second sub-controller to jump to the third and implement the method.
-(Ibaction) Jump2three: (ID) sender{
1. Create a third controller
2. Add a third controller to the navigation controller
[Self.navigationcontroller Pushviewcontroller:three Animated:yes];
}
Second, the management of navigation controller
The navigation controller is a stack of the form to manage the sub-controller (advanced after the similar badminton barrel)
View structure of the navigation controller
====>
Create one controller (placed in the stack of the navigation Controller)-Automatically create a view of the one controller and place it on top of the navigation controller's view.
Create a second controller (placed in the stack of the navigation controller) and automatically create a view of the controller and push the view of the one controller so that the view is displayed for both controllers,
Note: One's view is not destroyed at this time
=====>
Then create the three controller (which is placed in the stack of the navigation controller)--Automatically create a view of the three controller and push the view of the controller, so the view of the three controller is displayed, note: The view of one and the view of the other is not destroyed at this time
PS: View displayed on the navigation controller is always the view of the stack top controller
When you click Back, the three controller is removed from the stack of the navigation controller and destroyed, and the view of the three controller is destroyed, and the top controller is changed from the three controller to the controller, so now the view of the controller is displayed on the screen.
When you click Back, the controller is removed from the navigation controller's stack and destroyed, and the view of the controller is destroyed, and the top controller is changed from the controller to the one controller, so now the view on the screen is displayed on the
iOS Foundation-uikit framework-Multi-controller management-uinavigationcontroller