iOS navigation controller common functions and Navigationbar Common Properties

Source: Internet
Author: User

The time of common function triggering of navigation controller

when the view controller's View trigger when it will appear

-(void) viewwillappear: ( BOOL ) Animated

when the view controller's View triggered when already present

-(void) viewdidappear: ( BOOL ) Animated

when the view controller's View triggers when it's going to disappear

-(void) viewwilldisappear: ( BOOL ) Animated

when the view controller's View triggered when it has disappeared

-(void) viewdiddisappear: ( BOOL ) Animated


When the previous interface ,push Next interface Span style= "FONT-SIZE:12PX; Color: #1d9421; font:18.0px Menlo "", a  push B, four methods of execution order a (viewwilldisappear) >b (viewwillappear) >a (viewdiddisappear) >b ( viewdidappear)

when the next interface Pop previous interface, such as B pop A, four method execution order B (viewwilldisappear) >a (viewwillappear) >b (viewdiddisappear) >a (viewdidappear)

Navigationbar Common Properties
I. TheNavigationbarDirect Configuration,so the operation for each interfaceNavigationbarwill have an impact on the content displayed on the(the effect is the same)
1.ModifyNavigationbarColor

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 *,will only giveNavigationbarattached sheet

2.height less than,and greater than -and less than:is tiledNavigationbarand display on the status bar 

3.height equals:The whole picture inNavigationbarand display on the status bar


[Self.navigationController.navigationBar setbackgroundimage:[uiimage imagenamed:@ "32050"] forbarmetrics: Uibarmetricsdefault];

two. For each interface the Navigationbar individually tailored to the content displayed on the ( Each interface shows different content )
individually Customizable , Modify the View controller's Navigationitem

1.set the interface'stitle
self.navigationItem.title = @ "Great East Development";
2.ModifyTitleview (Middle Display View)
Uisegmentedcontrol*segment = [[UisegmentedcontrolAlloc]Initwithitems:@[@"Grouping",@"Friends"]]; Self.Navigationitem.Titleview= segment; [SegmentRelease];
3.ModifyNavigationbar Color Self.navigationController.navigationBar.barTintColor = [Uicolor whitecolor];

4.ModifyNavigationbar,Show content on the right
Uibarbuttonitem *right = [[Uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target: Self action: @selector (add:)];

Self.navigationItem.rightBarButtonItem = right;

[right release];
5.modify Navigationbar, show content on left
Uibarbuttonitem*left = [[UibarbuttonitemAlloc]Initwithbarbuttonsystemitem:UibarbuttonsystemitemaddTarget: SelfAction:@selector(add:)];

    Self.Navigationitem.Leftbarbuttonitem= left;

[ left release];



iOS navigation controller common functions and Navigationbar Common Properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.