如何从其他故事板场景中的主故事板场景访问变量?

时间:2012-12-23 05:17:00

标签: iphone ios

我正在开发一个包含3个故事板场景的应用程序。在第一个故事板场景中,我有一些我想在其他两个场景中访问的变量。我该怎么做?我使用Storyboard segue导航到其他两个场景,并在按钮上单击

调用以下内容
[self performSegueWithIdentifier:@"nameofsegue" sender:self];

1 个答案:

答案 0 :(得分:0)

使用此方法

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"nameofsegue"]) {
        YourDestinationVC *dvc = [segue destinationViewController];
        YourSourceVC *svc = (YourSourceVC*)sender;
        //set your ivr here
    }
}