/** * Configure public properties, which function on all navigation bar interfaces;*/- (void) configureconmmonpropety {//1. Set the color of the navigation barSelf.navigationController.navigationBar.barTintColor =[Uicolor Yellowcolor]; //2. Turn off the frosted glass effect on the navigation bar .Self.navigationController.navigationBar.translucent =NO; //3. Hide the navigation barSelf.navigationController.navigationBar.hidden =NO; //4. Set the render color of the navigation bar contentSelf.navigationController.navigationBar.tintColor =[Uicolor Purplecolor]; //5. Set the background picture of the navigation bar. //The picture size is different, the effect of the display is not the same; (must be very strict)//[Self.navigationController.navigationBar setbackgroundimage:<# (UIImage *) #> forbarmetrics:<# ( Uibarmetrics) #>]; //6. Set the size and color of the title text of the navigation barNsdictionary *dic = @{nsfontattributename:[uifont boldsystemfontofsize: -], Nsforegroundcolorattributename:[uicolor Redcolor]}; Self.navigationController.navigationBar.titleTextAttributes=DiC;}/** * Customize the navigation bar content for the current interface individually*/- (void) customizednavigationbarcontent {//Configure the caption that appears on the navigation barSelf.navigationItem.title =@"First Interface"; //Configure the title view of the navigation barUisegmentedcontrol *segment = [[Uisegmentedcontrol alloc] initwithitems:@[@"National",@"Area"]]; Self.navigationItem.titleView=segment; [Segment release]; //Configure left content, Show Trash buttonUibarbuttonitem *leftitem =[[Uibarbuttonitem alloc] Initwithbarbuttonsystemitem:uibarbuttonsystemitemtrash target:self action: @selector ( Handletrash:)]; Self.navigationItem.leftBarButtonItem=Leftitem; [Leftitem release]; //Configure the right contentUibarbuttonitem *rightitem =[[Uibarbuttonitem alloc] Initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target:self action: @selector ( Handleadd:)]; Self.navigationItem.rightBarButtonItem=Rightitem; [Rightitem release]; }
When setting up the navigationbar, such as adding a scrollview, the system will automatically move the ScrollView down from the top 64 pixels, in order to avoid this, we have two ways:
1. Turn off the navigationbar effect of the wool glass;
2. Automaticallyadjustsscrollviewinsets the Navigationbar property = NO;
< follow-up supplement, today only learned a fur;
Some property settings for the navigation bar Navigationcontrol