views:

36

answers:

1

Let's say I declare an NSMutableArray in the class file foo.h. Then in the viewDidLoad method in foo.m I populate the array. Inside foo.m I can add, delete, or modify array elements.

Then let's say the following code executes inside foo.m

[self.navigationController pushViewController:bar animated:YES];

This will switch the view and program execution will continue inside bar.m. How can I do all the things to the array in bar.m that I was able to do in foo.m?

A: 

I found out how to do it. The second view controller should also import the class that foo imports. Right before pushing the second view controller, set that class object equivalent to the object that the user selected. Any changes to that object will occur to the same object in the array.

When you go back to the table view though you won't see the changes unless you reload the table. That's a different story though.

awakeFromNib