IOS Navigationbar navigation Bar Customization

Source: Internet
Author: User

1. Set the background color of the navigation bar Navigationbar:

a) setbartintcolor: Set the color of the Nagivationbar

You can also use:

[[Uinavigationbar appearance] Setbartintcolor:[uicolor Yellowcolor]];

(In the interface of Uinavigationcontroller execution Pushviewcontroller again the color will change after Setbartintcolor, the same uinavigationbar is set,)

b) Modify Navigationbar color with Self.navigationController.navigationBar.barTintColor in sub-page

Note: [Uinavigationbar appearance] method can only be used in Appdelegate,

The properties of Nagivationbar can only be modified by Self.navigationcontroller in Uinavigationcontroller's child pages.


c) settintcolor: Set the color of the button on the Nagivationbar:

Self.navigationController.navigationBar.tintColor = [Uicolor Bluecolor];


2. Set the color and properties of title on Navigationbar

a) [[Uinavigationbar appearance] Settitletextattributes:@{nsforegroundcolorattributename:[uicolor Whitecolor]}];

b) [Self.navigationController.navigationBar settitletextattributes:@{nsforegroundcolorattributename:[ Uicolor Whitecolor]}];

3. About the navigation bar Back button:

Customize the Back button of the next interface in the previous interface using: Self.navigationItem.backBarButtonItem

On the current page , customize the return button using: Self. Navigationitem. Leftbarbuttonitem

4. When switching to the next view using Pushviewcontroller, the navigation controller changes the left button of the navigation bar in the following 3 order:

1. If b view has a custom left button (Leftbarbuttonitem), the custom button will be displayed;

2. If B does not have a custom button, but the Backbarbuttonitem property of a view has a customization, the customization is displayed;

3, if none of the first 2, then the default display a Back button, the title of the Back button is a view of the title;

Reference: http://www.cnblogs.com/yujinzhong/p/5664546.html

Reprint Please specify source:http://www.cnblogs.com/ficow/p/7136954.html

IOS Navigationbar navigation Bar Customization

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.