Uistoryboardsegue Analysis of iOS learning

Source: Internet
Author: User

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

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.