我有两个视图控制器,firstViewController和secondViewController.我使用下面的代码切换到我的secondViewController (我还向它传递了一个字符串):
secondViewController *second = [[secondViewController alloc] initWithNibName:nil bundle:nil];
second.myString = @"This text is passed from firstViewController!";
second.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:second animated:YES];
[second release];
然后,我在secondViewController中使用以下代码切换回firstViewController:
[self dismissModalViewControllerAnimated:YES];
所有这些都运行得很好。我的问题是,我如何将数据传递给firstViewController?我想从secondViewController向firstViewController传递一个不同的字符串。
https://stackoverflow.com/questions/6203799
复制相似问题