Some property settings for the navigation bar Navigationcontrol

Source: Internet
Author: User

/** * 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

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.