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