In APPDelegate.h, the entry part of the project
Didfinishlaunchingwithoptions This method means that the app starts and then goes to the custom interface
The following myviewcontroller are custom classes, i.e. an interface implements the Uiviewcontroller interface
- (BOOL) Application: (uiapplication *) Application didfinishlaunchingwithoptions: (NSDictionary *) launchoptions { // override point for customization after application launch. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; MyViewController *myController = [[MyViewController alloc] init]; uinavigationcontroller *navcontroller = [[ uinavigationcontroller alloc] initwithrootviewcontroller:mycontroller]; self.window.rootviewcontroller = navcontroller; [ Self.window makekeyandvisible]; &nbSp; return yes;}
myviewcontroller.h//defines four controls @interface myviewcontroller : uiviewcontroller@property ( strong, nonatomic) UILabel *labelNum; @property (strong, nonatomic) UILabel *labelpwd, @property (strong, nonatomic) UITextField *fieldNum; @property (Strong, nonatomic) UITextField *fieldPwd; @end //MyViewController.m- (void) viewdidload { [super viewdidload]; // do any additional setup after loading the view. self.labelnum = [[uilabel alloc] init]; self.labelnum.frame = cgrectmake (100, 100, 50, 20); self.labelnum.text = @ "Num : "; self.fieldnum = [[uitextfield alloc] init]; &nBsp;self.fieldnum.frame = cgrectmake (150, 100, 100, 20); self.fieldnum.borderstyle = uitextborderstyleroundedrect; self.labelpwd = [[uilabel alloc] init]; self.labelpwd.frame = cgrectmake (100, 150, 50, 20); self.labelpwd.text = @ "pwd: "; self.fieldpwd = [[uitextfield alloc] init]; self.fieldpwd.frame = cgrectmake (150, 150,  100, 20); self.fieldpwd.borderstyle = uitextborderstyleroundedrect ; uibutton *btn = [uibutton buttonwithtype: Uibuttontyperoundedrect]; btn.frame = cgrectmake (100, 200, 80,  20); btn.backgroundcolor = [uicolor graycolor]; [btn settitle:@ "Login" forstate:uicontrolstatenormal]; //Set Button listener event, monitoring method is login [btn addtarget:self action: @selector (login) forcontrolevents: Uicontroleventtouchdown]; [self.view addSubview:self.labelNum]; [self.view addSubview:self.fieldNum]; [self.view addsubview:self.labelpwd]; [ self.view addsubview:self.fieldpwd]; [self.view ADDSUBVIEW:BTN];}
Page jumps, and passes parameters
-(void) login{ nslog (@ "login"); nsstring *num = self.fieldnum.text; nsstring *pwd = Self.fieldpwd.text; if ([num isequaltostring:@ "123"] = = true) { NSLog (@ "yes") //initialize the interface to jump MainViewController *mm = [[MainViewController alloc] init]; //Pass the account password to the next interface [mm initData:num two:pwd]; //Start Jump [self.navigationcontroller pushviewcontroller:mm animated:false]; }else{ nslog (@ "error"); } }
MainViewController.h
@interface mainviewcontroller:uiviewcontroller//@property (nonatomic) nsstring//pass two parameters A, B nsstring type-(void) InitData: (NSString *) A: (NSString *) b; @end
Receive parameters, and save-(void) InitData: (NSString *) A: (NSString *) b{self.num = A; Self.pwd = b; NSLog (@ "%@,%@", Self.num, self.pwd);}
//
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/84/23/wKioL1eG9DuBJBUUAAG9p59ZXWs980.png-wh_500x0-wm_3 -wmp_4-s_2753822497.png "title=" Qq20160714100738.png "alt=" Wkiol1eg9dubjbuuaag9p59zxws980.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/84/24/wKiom1eG9CuzaD8tAAM13Mxk85k431.png-wh_500x0-wm_3 -wmp_4-s_597978808.png "title=" Qq20160714100755.png "alt=" Wkiom1eg9cuzad8taam13mxk85k431.png-wh_50 "/>
This article is from the "climb over the mountains to see the Sea" blog, please be sure to keep this source http://670176656.blog.51cto.com/4500575/1826266
Interface jump and pass value