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)