1

我有一个问题,我可以使用将所有数据传递给推送视图控制器

[self performSegueWithIdentifier:@"Expense" sender: self]; 

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender  

但是,当视图控制器弹出时,我不知道如何取回数据。我有几个数组需要从弹出的视图控制器传递到父视图控制器。

4

2 回答 2

0

Create a class to serve as the data model for your application and have it include the arrays you need to pass around. Create an object of that class in your first controller, share it with the second controller during prepareForSegue:, let the second controller update it, and read the new values when the parent's view appears again.

于 2012-12-18T12:30:56.703 回答
0

You should use segues to pass data forward and Delegate Methods to send data back in your navigation stack. That is the recommended approach. I answered a similar question earlier. Although the question may sound different, the underlying solution should work in your case as well.

于 2012-12-18T12:33:00.527 回答