如何在故事板细分之间传递信息? [英] How do I pass information between storyboard segues?

查看:99
本文介绍了如何在故事板细分之间传递信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在创建的应用中,其中一项功能是用户可以提交自己的引号以显示在应用中。有一个故事板segue允许用户输入他们的名字,电子邮件和网站,然后在下一个他们输入报价,然后应用程序将所有这些数据发布到数据库。我不确定如何轻松地将数据从第一个故事板segue传递到下一个故事板,以便它可以一次性将所有信息发布到数据库。提前感谢您的任何回复。

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.

推荐答案

使用 prepareForSegue:sender:将数据从源传递到目标视图控制器的方法:

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 = ...;
    }
}

这篇关于如何在故事板细分之间传递信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆