iPhone Setting ViewController nested in NSMutableArray
- by Peter George
Hello I'm trying to set attributes for a viewcontroller nested inside a NSMutableArray,
for example I have 3 ViewController inside this array:
FirstViewController *firstViewController = [FirstViewController alloc];
SecondViewController *secondViewController = [SecondViewController alloc];
ThirdViewController *thirdViewController = [ThirdViewController alloc];
NSMutableArray *viewControllerClasses = [[NSMutableArray alloc] initWithObjects:
firstViewController,
secondViewController,
thirdViewController,
nil];
for (int x=0; x<[viewControllerClasses count]; x++) {
// as an example to set managedObjectContext I otherwise would set firstViewController.managedObjectContext = context;
[viewControllerClasses objectAtIndex:x].managedObjectContext = context;
}
But this results in an error: Request for member "managedObjectContext" in something not a structure or union.
Shouldn't be "firstViewController" be the same as [viewControllerClasses objectAtIndex:0]?