Swift development tutorial-use Storyboard for interface jump, swiftstoryboard

Source: Internet
Author: User

Swift development tutorial-use Storyboard for interface jump, swiftstoryboard

Using storyboard with code can indeed bring a lot of convenience for development.

In practice, we often encounter page Jump problems. You can create a "connection" through the control and interface.

If it is a jump to navigationcontroller, select the push method (otherwise, an error will be reported when xcode is running );

If it is a jump to Viewcontroller, select modal mode.

If you want to open another interface through code, you need to set the seue. identifier for the connection between them. For example, you need to set it to jumpid.

Then the code can be written as follows:

Self. inclumseguewithidentifier ("jumpid", sender: self );

If you want to pass a value during the jump, you can write as follows:

Override func prepareForSegue (segue: UIStoryboardSegue, sender: AnyObject ?) {

If (segue. identifier = "jumpid "){

Var barInfo: BarInfoViewController = segue. destinationViewControlleras! BarInfoViewController;

BarInfo. name = "david ";

BarInfo. age = 99;



Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.