When I first came in:
When you click the button on the right:
Rootviewcontroller. h
#import <UIKit/UIKit.h>@interface RootViewController : UIViewController{ UIButton * leftButton; UIButton * rightButton; UIViewController * firstController; UIViewController * secondController;}@end
Rootviewcontroller. m
-(Void) viewdidload {[Super viewdidload]; // do any additional setup after loading the view. // initialize the top button [self creatheadview]; // initialize the background image [self initbackview];} # pragma-mark-functions-(void) initbackview {firstcontroller = [[uiviewcontroller alloc] init]; firstcontroller. view. backgroundcolor = [uicolor redcolor]; [self. view addsubview: firstcontroller. view]; secondcontroller = [[uiviewcontroller alloc] init]; secondcontroller. view. backgroundcolor = [uicolor bluecolor];}-(void) creatheadview {uiview * headview = [[uiview alloc] initwithframe: cgrectmake (0, 0,100, 30)]; // The left button leftbutton = [uibutton buttonwithtype: uibuttontypecustom]; leftbutton. frame = cgrectmake (0, 0, 50, 30); leftbutton. tag= 201; leftbutton. enabled = no; [leftbutton setimage: [uiimage imagenamed: @ "Left"] forstate: uicontrolstatenormal]; [leftbutton addtarget: Self action: @ selector (doclickheadactions :) forcontrolevents: role]; [headview addsubview: leftbutton]; // the right button rightbutton = [uibutton buttonwithtype: uibuttontypecustom]; rightbutton. frame = cgrectmake (50, 0, 50, 30); rightbutton. tag = 301; [rightbutton setimage: [uiimage imagenamed: @ "right"] forstate: uicontrolstatenormal]; [rightbutton addtarget: Self action: @ selector (doclickheadactions :) forcontrolevents: role]; [headview addsubview: rightbutton]; self. navigationitem. titleview = headview;} # pragma-mark-doclickactions-(void) doclickheadactions :( uibutton *) BTN {If (BTN. tag = 201) {[secondcontroller dismissviewcontrolleranimated: no completion: Nil]; [BTN setimage: [uiimage imagenamed: @ "leftselect"] forstate: uicontrolstatenormal]; BTN. enabled = no; [rightbutton setimage: [uiimage imagenamed: @ "right"] forstate: uicontrolstatenormal]; rightbutton. enabled = yes;} else if (BTN. tag = 301) {[firstcontroller presentviewcontroller: secondcontroller animated: no completion: Nil]; [BTN setimage: [uiimage imagenamed: @ "rightselect"] forstate: uicontrolstatenormal]; BTN. enabled = no; [leftbutton setimage: [uiimage imagenamed: @ "Left"] forstate: uicontrolstatenormal]; leftbutton. enabled = yes ;}}
Two icons in the title. When you click the icon, the page will jump to the next page (similar to the area near anjuke's new house)