Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
225 views
in Technique[技术] by (71.8m points)

ios - How do I pass information between storyboard segues?

In the app I'm creating, one of the features is that users can submit their own quotes to be displayed in the app. There is one storyboard segue that lets the user enter their name, email and website, and then on the next they type in a quote and the app then posts all of this data to a database. I'm not sure how I can easily pass data from the first storyboard segue to the next, so that it can post all of the information to the database in one go. Thanks in advance for any replies.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use the prepareForSegue:sender: method to pass data from the source to destination view controller:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:...]) {
        MyViewController *controller = (MyViewController *)segue.destinationViewController;
        controller.myProperty1 = ...;
        controller.myProperty2 = ...;
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...