-(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