iOS navigation bar configuration issues

Source: Internet
Author: User

1: Navigation bar

Change status bar, but need to add field View controller-based status bar appearance = = NO default Yes

[UIApplication sharedapplication].statusbarstyle = uistatusbarstylelightcontent;

1. Set the color of the navigation bar

Self.navigationController.navigationBar.barTintColor = [Uicolor Redcolor];

2. Turn off the frosted glass effect on the navigation bar.

Self.navigationController.navigationBar.translucent = YES;

3. Hide the navigation bar

Self.navigationController.navigationBar.hidden = NO;

4. Set the render color of the navigation bar content

Self.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 bar

Nsdictionary *dic = @{nsfontattributename:[uifont boldsystemfontofsize:18], Nsforegroundcolorat Tributename:[uicolor Redcolor]};

Self.navigationController.navigationBar.titleTextAttributes = dic;

2:

/**

* Customize the navigation bar content individually for the current interface

*/

-(void) Customizednavigationbarcontent {

Configure the caption that appears on the navigation bar

Self.navigationItem.title = @ "First interface";

Configure the title view of the navigation bar

Uisegmentedcontrol *segment = [[Uisegmentedcontrol alloc] initwithitems:@[@ "Country", @ "region"];

Self.navigationItem.titleView = segment;

Configure left content, Show Trash button

Uibarbuttonitem *leftitem = [[Uibarbuttonitem alloc] Initwithbarbuttonsystemitem:uibarbuttonsystemitemtrash target:      Self action: @selector (Handletrash:)]; Self.navigationItem.leftBarButtonItem = Leftitem;

Configure the right content

Uibarbuttonitem *rightitem = [[Uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target: Self action: @selector (Handleadd:)];

Self.navigationItem.rightBarButtonItem = Rightitem;

}

/**

*//When setting 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;

iOS navigation bar configuration issues

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.