Summary of common UI Methods --- uinavigationcontroller (continuously updating)

Source: Internet
Author: User

Uinavigationcontroller: Uiviewcontroller


1. Create a uinavigationcontroller object

Uinavigationcontroller * navcv = [[uinavigationcontrolleralloc] initwithrootviewcontroller: mainvc];

Normally

Self. Window. rootviewcontroller = navcv;

Used


2.-(void) pushviewcontroller :( uiviewcontroller *) viewcontroller animated :( bool) animated;

Launch the second page

Eg: [self. navigationcontrollerpushviewcontroller: secondvc animated: Yes];


3.-(uiviewcontroller *) popviewcontrolleranimated :( bool) animated;

Back to previous view

Eg: [self. navigationcontrollerpopviewcontrolleranimated: Yes];


4.-(nsarray *) poptoviewcontroller :( uiviewcontroller *) viewcontroller animated :( bool) animated;

Returns the specified view.

Eg: Get the stack of viewcontroller

Uiviewcontroller * viewc = [self. navigationcontroller. viewcontrollersobjectatindex: 0];

[Self. navigationcontroller poptoviewcontroller: viewc animated: Yes];


5.-(nsarray *) poptorootviewcontrolleranimated :( bool) animated;

Back to Root View

Eg: [self. navigationcontrollerpoptorootviewcontrolleranimated: Yes];




Uinavigationitem: Nsobject <nscoding>

Content of each page to be displayed on the navigation bar (title, button information on both sides)


1. rightbarbuttonitem

Create button on the right of the navigation bar

Parameter 1: select an icon provided by the system

Eg: Self. navigationitem. rightbarbuttonitem = [[[uibarbuttonitem alloc] initwithbarbuttonsystemitem: uibarbuttonsystemitemrefresh target: Self action: @ selector (Button :)] orautelease];


2. leftbarbuttonitem

Create button on the left of the navigation bar

Eg: Self. navigationitem. leftbarbuttonitem = [[[uibarbuttonitem alloc] initwithimage: [uiimage imagenamed: @ "iconfont-yinle.png"] style: uibarbuttonitemstyleplain target: Self action: @ selector (Button :)] autorelease];


3. hidesbackbutton

Hide the return button

Eg: Self. navigationitem. hidesbackbutton = yes;


4. titleview

Title settings

Eg: Self. navigationitem. titleview = [[[uisegmentedcontrolalloc] initwithitems: @ [@ "111", @ "222"] autorelease];



Uinavigationbar


1. translucent

Transparent or not

Eg: Self. navigationcontroller. navigationbar. translucent = yes;


2. bartintcolor

The color of bar. For example, self. navigationcontroller. navigationbar. bartintcolor = [uicolor graycolor];


3. setnavigationbarhidden

Hide bar

E.g.: [self. navigationcontrollersetnavigationbarhidden: No];


4. automaticallyadjustsscrollviewinsets

Cancel the uiedgeinsets set by the scrollview system.

E.g.: elf. automaticallyadjustsscrollviewinsets = yes;

(This switch can be used when an unpredictable problem occurs on the page)


5. setbackgroundimage

Set Bar background image

Eg: [self. navigationcontroller. navigationbarsetbackgroundimage: [uiimageimagenamed: @ "2.png"] forbarmetrics: uibarmetricsdefault];

Summary of common UI Methods --- uinavigationcontroller (continuously updating)

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.