Swift Development Tutorials-use storyboard for interface jumps

Source: Internet
Author: User

Using the storyboard combination of code to do this can actually bring a lot of convenience to development.

In the process of practice, we often encounter the problem of the interface jump. Through the creation of controls and interfaces The "connection" is OK.

If it is Navigationcontroller jump, then choose the way of push (otherwise Xcode will be error when running);

If it is a viewcontroller jump, select the Modal method.

If you want to open another interface through the code, you need to set the segue of the connection between them . identifier, for example, you set to JumpID.

The code can then be written like this:

Self . Performseguewithidentifier ("JumpID", Sender:self);


If you still want to pass the values over when you jump, you can write:

Override func prepareforsegue (segue:uistoryboardsegue, Sender: anyobject ?) {

if(segue. identifier == "JumpID" ) {

var barinfo:barinfoviewcontroller = segue. Destinationviewcontroller as! Barinfoviewcontroller ;

Barinfo. name = "David" ;

Barinfo. Age = About ;

}

}


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Swift Development Tutorials-use storyboard for interface jumps

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.