Hi, I'm sure this is basic and I am missing the obvious.
I have an app that has two view controllers, the delegate is used to switch between the two controllers. Lets call these ViewController1 and ViewController2.
If I have an NSMutableArray *arr defined and loaded with data in ViewController1 what is the best way to use this data in ViewController2?
I have tried the following in ViewController2's viewDidLoad method but this doesn't work:
Code:
TMCClientAppDelegate *mainDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
arr = [mainDelegate.viewController1.arr copy];
In MyAppDelegate I have the property viewController1 created as the instance of ViewController1, and arr is a property of ViewController1, so am not sure why I cannot access it this way.
Anyone see whats wrong here or can suggest a better way to do this?
Thanks!
Andy