iPhone Setting ViewController nested in NSMutableArray
Posted
by Peter George
on Stack Overflow
See other posts from Stack Overflow
or by Peter George
Published on 2010-05-08T18:32:11Z
Indexed on
2010/05/08
18:38 UTC
Read the original article
Hit count: 318
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]?
© Stack Overflow or respective owner