Record some easily forgotten attributes-uinavigationcontroller

Source: Internet
Author: User

// Set the style of the navigation bar
Self. navigationcontroller. navigationbar. barstyle = uibarstyledefault;
// Set whether the navigation bar is transparent, no transparency, yes transparency. The default value is yes;

// When the translucent attribute in the navigation bar is set to yes, the coordinate origin of the current view controller is in the upper left corner of the screen
// When the translucent attribute in the navigation bar is set to no, the coordinates of the current view controller are located in the upper left corner of the screen (the height from the Y axis to the navigation bar (44 ))
Self. navigationcontroller. navigationbar. translucent = no;

// Set the color of the element in the navigation bar
Self. navigationcontroller. navigationbar. tintcolor = [uicolor yellowcolor];

// Set the foreground color of the navigation bar
Self. navigationcontroller. navigationbar. bartintcolor = [uicolor cyancolor];

// Hide the navigation bar
Self. navigationcontroller. navigationbarhidden = no;

// Set the background image in the navigation bar
// Uibarmetricsdefault portrait (front screen)
// Uibarmetricslandscapephone Landscape Painting (side screen)
[Self. navigationcontroller. navigationbar setbackgroundimage: [uiimage imagenamed: @ "navbarbg1"] forbarmetrics: uibarmetricsdefault];
[Self. navigationcontroller. navigationbar setbackgroundimage: [uiimage imagenamed: @ "navbarbg2"] forbarmetrics: uibarmetricslandscapephone];

// Set the title view of the navigation item. The priority is higher than the following two methods.
Uiview * titleview = [[uiview alloc] initwithframe: cgrectmake (0, 0, 40, 40)];
Titleview. backgroundcolor = [uicolor purplecolor];
Self. navigationitem. titleview = titleview;

// Set the View Controller name
// The priorities set in the two methods are the same.
1 self. navigationitem. Title = @ "controllone ";
2 self. Title = @ "Controller 1 ";

 

// Place all the navigation element items in the navigationitem of the View Controller.
// All view controllers have their own independent navigation element items, but the public navigation bar

// Crop the part that exceeds the Boundary
Self. navigationcontroller. navigationbar. clipstobounds = yes;

 

Record some easily forgotten attributes-uinavigationcontroller

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.