I want to navigate from one ViewController to another. As part of this I want to pass the ViewController I want to navigate to some information. I encapsulated the information into an Object that I want to hook up as an external object with the target viewController.
I created the external Object inside IB gave it the identifier I referenced in the NSDictionary that is passed to the NibLoading method.
NSArray* topLevelObjs = nil;
NSMutableDictionary* options = [[NSMutableDictionary alloc] initWithCapacity:1];
NSMutableDictionary* config = [[NSMutableDictionary alloc] initWithCapacity:1];
id detailImageVC = [[SelectedImageModalViewController alloc] init];
SelectedImageModalModel* selectImageModalModel = [[SelectedImageModalModel alloc] init];
selectImageModalModel.imageName = @"img@2x.png";
[config setValue:selectImageModalModel forKey:@"SelectImageModalModel"];
[options setValue:config forKey:UINibExternalObjects];
topLevelObjs = [[NSBundle mainBundle] loadNibNamed:@"SelectedImageModalViewController" owner:detailImageVC options:options];
if ([topLevelObjs count] == 0)
{
NSLog(@"Warning! Could not substitute proxy objects in xib file.\n");
return;
}
[appDelegate.navigationController presentModalViewController:detailImageVC animated:YES];
[options release];
[config release];
[selectImageModalModel release];
[detailImageVC release];
What I expected was, that after I called presentModalViewController:animated: I would receive a call to viewDidLoad on the very same detailImageVC with my external objects connected.
Instead neither happens. viewWillApear: will get called, but the detailImageVC won't hold my external reference.
Any idea, hind or comment is appreciated. Thanks!