How can I get access to a NSMutableArray that has been hydrated in different Class? There is my sample code:
Class1.h : I have an iVar NSMutableArray *anArray;
And I @synthesize anArray; it in Class1.m
In the RootViewController I import the Class1.h and addd @Class "Class1";
The in the interface I add the Class1 *aClass1; in the RootViewController.m I @synthesize it and in the ViewWillAppear
aClass1 = [[Class1 alloc] init];
aClass1.anArray = [[NSMutableArray alloc] initWithObjects: @"string1",@"string2",nil];
NSLog(@"aClass1.anArray is Class1 %@",aClass1.anArray); // It works as I expected
Now in the new class I call it DetailsViewController
Same as the RootViewController.h I imported the .h and @class "Class1";.
Also in the DetailsViewController.m I have imported the "Class1.h"
So now in the DetailsViewController I try to do this in the viewWillAppear
NSLog(@"aClass1.anArray in DetailsViewController %@",aClass1.anArray); // PROBLEM: It comes back as null
I have added this sample project in this address: http://www.epicdesign.com.au/test2.zip