In the visual programming of Storyboard, the jump interface is to hold down CTRL and use the mouse to connect the first line can be solved, quite simple! This blog is mainly about this connection, in iOS, this line is also an object, but also has its own initialization methods and properties. This object is Uistoryboardsegue.
Overview and customization of Uistoryboardsegue previously introduced in visual programming-Storyboard
1. Properties of Segue
Each of the Segue objects has 3 properties
// uniquely identifies readonly) NSString *identifier; // Source Controller readonly) __kindof Uiviewcontroller *Sourceviewcontroller; // Target Controller readonly) __kindof Uiviewcontroller *destinationviewcontroller;
2, the type of segue
Depending on the segue execution (jump) moment, the segue can be divided into 2 major categories:
- Auto-type: After clicking on a control (such as a button), automatically executes the segue, automatically completes the page jump
Hold down the Ctrl key to drag lines directly from the control to the relationship line generated by the target controller
Click "Login" button , will automatically jump to the right controller
usage : If you click on a control, do not need to make any judgment, be sure to jump to the next interface, it is recommended to use "Automatic type Segue"
- Manual type: You need to write code to manually execute segue to complete the page jump
Hold down the Ctrl key to drag lines from the source controller to the relationship lines generated by the target controller
Manual type setting uniquely identifies such as:
At the right moment, use the Perform method to perform the corresponding Segue, as follows:
// This method is a method of Uiviewcontroller // parameter 1: identifier representing the manual type segue above // parameter 2: Pass something that is not used when set to nil-(voidID) Sender
code example:
#pragmaMark-Login Button button-(ibaction) Loginbtnaction: (ID) sender{//prompt user, logging in to ing ...[Mbprogresshud ShowMessage:@"logging in to ing ..."]; //Emulate delayed LoginDispatch_after (Dispatch_time (Dispatch_time_now, (int64_t) (1* nsec_per_sec)), Dispatch_get_main_queue (), ^{ //Hide Masks[Mbprogresshud Hidehud];//Uistoryboardsegue if([_accounttextfiled.text isequaltostring:@"ZF"] && [_pwdtextfield.text isequaltostring:@"123"]) {//Enter the correct//jump to the contact screen[Self Performseguewithidentifier:@"login2contactlist"Sender:nil]; } Else{//Enter the correct[Mbprogresshud ShowError:@"user or password input error"]; } }); }
Uistoryboardsegue Analysis of iOS learning