Navigation bar, status bar highlighting state change

Source: Internet
Author: User

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {Self.window=[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]; //Override point for customization after application launch.Self.window.backgroundColor =[Uicolor Whitecolor]; Rootviewcontroller*root=[[Rootviewcontroller alloc]init]; Uinavigationcontroller*nav=[[Uinavigationcontroller alloc]initwithrootviewcontroller:root]; //[[Uinavigationbar Appearance]settintcolor:[uicolor Redcolor]]; //use Bartintcolor to change the background color of the navigation bar after iOS 7//[[Uinavigationbar Appearance]setbartintcolor:[uicolor Cyancolor]];[[Uinavigationbar appearance] Setbartintcolor:uicolorfromrgb (0X067AB5)]; //set up a picture//[[Uinavigationbar appearance] Setbackgroundimage:[uiimage imagenamed:@ "U27.png"] forbarmetrics:    Uibarmetricsdefault]; //The color of the returned font after a jump on the navigation bar[[Uinavigationbar appearance] Settintcolor:[uicolor Redcolor]];        [[Uinavigationbar appearance] settranslucent:yes]; Self.window.rootViewController=nav; //the status bar becomes highlighted (white)[[UIApplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent]; //status bar Hidden//[UIApplication Sharedapplication].statusbarhidden=yes; //navigation bar Hidden//[Self.navigationcontroller Setnavigationbarhidden:yes];[Self.window makekeyandvisible]; returnYES;}//or add a key View controller-based status bar appearance in info. plist and change it to NO; ----set to highlight State//add a key status in info. plist Bar is initially hidden change him to Yes to hide the status bar (all status bars after launching the app)

#import "RootViewController.h"#import "NextViewController.h"#defineUicolorfromrgb (rgbvalue) [Uicolor colorwithred: ((float) ((Rgbvalue & 0xFF0000) >>))/255.0 Green: ((float) ( (Rgbvalue & 0xff00) >> 8)/255.0 Blue: ((float) (Rgbvalue & 0xFF))/255.0 alpha:1.0]@interfaceRootviewcontroller () {Nextviewcontroller*next;}@end@implementationRootviewcontroller- (void) viewdidload {[Super viewdidload]; Next=[[Nextviewcontroller alloc]init]; UIButton*btn=[UIButton Buttonwithtype:uibuttontypecustom]; Btn.frame=cgrectmake ( -, -, -, -); Btn.backgroundcolor=[Uicolor Blackcolor];    [Btn addtarget:self Action: @selector (PRESSBTN) forcontrolevents:uicontroleventtouchupinside]; [Btn setimage:[uiimage imagenamed:@"U2.png"] Forstate:uicontrolstatenormal]; Self.navigationItem.title=@"Test"; //[Self.navigationitem settitle:@ "SSSs"]; All right//change the size and color of the title bar font//You can also create a label to add a label to the navigation bar, and then set the transparency[Self.navigationController.navigationBar Settitletextattributes:@{nsfontattributename:[uifont Systemfontofsize: +],nsforegroundcolorattributename:[uicolor Whitecolor]}]; Uibarbuttonitem*item=[[Uibarbuttonitem alloc]initwithcustomview:btn]; Self.navigationItem.leftBarButtonItem=item; //navigation bar Hidden//[Self.navigationcontroller Setnavigationbarhidden:yes]; //[[Uinavigationbar appearance] Setbartintcolor:[uicolor Redcolor]];}-(void) Viewwillappear: (BOOL) animated{//color changes of navigation bars in different interfaces//Self.navigationcontroller.navigationbar.translucent=yes;Self.navigationController.navigationBar.barTintColor =[Uicolor Greencolor];}-(void) pressbtn{[Self.navigationcontroller pushviewcontroller:next animated:yes];}

#import "NextViewController.h"@interfaceNextviewcontroller ()@end@implementationNextviewcontroller- (void) viewdidload {[Super viewdidload]; }-(void) Viewwillappear: (BOOL) animated{//color changes of navigation bars in different interfaces//Self.navigationcontroller.navigationbar.translucent=yes;Self.navigationController.navigationBar.barTintColor =[Uicolor Cyancolor]; }

Navigation bar, status bar highlighting state change

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.