I am having two problems with a section of code involving NSNib.
Using InterfaceBuilder I create a nib file named ViewWindow.nib, which contains an instantiation of a window and a class of my definition called ViewWindow.
During app initialization I read in the nib:
viewWindowNib = [[NSNib alloc] initWithNibNamed: @"ViewWindow" bundle: [NSBundle mainBundle]];
This works fine. Later, I make this call to instantiate the nib objects: // instantiate a new ViewController and ViewWindow NSArray *objects; [viewWindowNib instantiateNibWithOwner: self topLevelObjects: &objects]; This also works fine: I get 2 elements in the array, one for each top level object in the nib.
In the awakeFromNib routine for the sending object, I have
for (i = 0; i < [objects count]; i++) { [[objects objectAtIndex: i] init]; if ([[objects objectAtIndex: i] respondsToSelector: @selector(viewControllerCheck:)]) { ...... }
Problem 1: I never get to the awakeFromNib routine after the first call to instantiateNibWithOwner:topLevelObjects. I get there only on the second and subsequent calls.
Problem 2: Although I have a viewControllerCheck: method defined in my ViewWindow class, the respondsToSelectormessage always returns FALSE.
Any insights would be appreciated. |