我有两个视图控制器,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];
Run Code Online (Sandbox Code Playgroud)
然后我在secondViewController中使用此代码切换回firstViewController:
[self dismissModalViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
所有这一切都很好.我的问题是,如何将数据传递给firstViewController?我想从secondViewController传递一个不同的字符串到firstViewController.