With Uinavigationcontroller, the navigation controller makes it easy to manage multiple controllers and easily switch between controllers, which is a typical example of the system's own "Setup" Application Uinavigationcontroller use steps
- Initialize Uinavigationcontroller
- Set the Rootviewcontroller for UIWindow to Uinavigationcontroller
- Depending on the situation, add the corresponding number of sub-controllers by the push method
Use the push method to push a controller into the stack
-(void) Pushviewcontroller: (Uiviewcontroller *) Viewcontroller animated: (BOOL) animated;
Use the Pop method to remove the controller from the top of the stack
-(Uiviewcontroller *) popviewcontrolleranimated: (BOOL) animated;
Back to the specified child controller
-(Nsarray *) Poptoviewcontroller: (Uiviewcontroller *) Viewcontroller animated: (BOOL) animated;
Back to root controller (stack bottom controller)
-(Nsarray *) poptorootviewcontrolleranimated: (BOOL) animated;
The contents of the navigation bar navigation bar are determined by the Navigationitem property of the top controller, Uinavigationitem has the following properties affecting the contents of the navigation bar. The Back button in the upper-left corner
@property (Nonatomic,retain) Uibarbuttonitem *backbarbuttonitem;
The middle title view
@property (Nonatomic,retain) UIView *titleview;
Middle Caption text
@property (nonatomic,copy) NSString *title;
The view in the upper-left corner
@property (Nonatomic,retain) Uibarbuttonitem *leftbarbuttonitem;
Uibarbuttonitem *rightbarbuttonitem view in the upper right corner
@property (Nonatomic,retain) Uibarbuttonitem *rightbarbuttonitem;
IOS UI Basics -11.0 Uinavigationcontroller