The time of common function triggering of navigation controller
Triggered when view controller's views are going to appear
-(void) Viewwillappear: (BOOL) animated
Triggered when view controller's views already appear
-(void) Viewdidappear: (BOOL) animated
Triggered when view controller's views are going to disappear
-(void) Viewwilldisappear: (BOOL) animated
Triggered when view controller's views have disappeared
-(void) Viewdiddisappear: (BOOL) animated
When the next interface is push by the previous interface, such as a push B, four method execution order a (viewwilldisappear) >b (viewwillappear) >a (viewdiddisappear) >b ( Viewdidappear)
When a previous interface pops up by the latter interface, such as B pop A, four methods of execution order B (viewwilldisappear) >a (viewwillappear) >b (viewdiddisappear) >a ( Viewdidappear)
Navigationbar Common Properties
I. Direct configuration of the Navigationbar, so this action will have an effect on the content displayed on each interface Navigationbar (the effect is the same
)
1. Modify the Navigationbar color
Self.navigationController.navigationBar.barTintColor = [Uicolor redcolor];
2. Turn off the navigationbar effect of the wool glass
Self.navigationController.navigationBar.translucent = NO;
3. Hide the Navigationbar
Self.navigationController.navigationBarHidden = yes;4. Set a picture for Navigationbar
Different sizes of picture effects are different
:
1.320 * 44, will only give Navigationbar
Attached sheet
2. Height less than 44, and greater than 44 and less than 64: tile Navigationbar and display on status bar
3. Height equals 64: Entire picture in Navigationbar
and display on the status bar
[Self.navigationController.navigationBar setbackgroundimage:[uiimage imagenamed:@ "32050"] forbarmetrics: Uibarmetricsdefault];
Two. Individually customize the content displayed on Navigationbar of each interface (different display content for each interface), modify The Navigationitem of the view controller
1. Set the interface's
Title
Self.navigationItem.title = @ "Far East development
”;
2. Modify Titleview (middle display view
)
Uisegmentedcontrol*segment = [[uisegmentedcontrolalloc]initwithitems:@[@ ' group ', @ ' friends ']; self.navigationitem.titleview= segment;
3. Modifications
Navigationbar color Self.navigationController.navigationBar.barTintColor = [Uicolor Whitecolor];
4. Modify the Navigationbar,
Show content on the right
Uibarbuttonitem *right = [[Uibarbuttonitem alloc] Initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target:self Action: @selector (add:)];
Self.navigationItem.rightBarButtonItem = right;
5.
Modify Navigationbar, show content on left
Uibarbuttonitem*left = [[Uibarbuttonitemalloc]initwithbarbuttonsystemitem:uibarbuttonsystemitemaddtarget: Selfaction: @selector
(add:)];
Self.navigationItem.leftBarButtonItem
= left;
iOS navigation controller common functions and Navigationbar Common Properties