• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
instantiateNibWithOwner and respondsToSelector
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

instantiateNibWithOwner and respondsToSelector


  • Subject: instantiateNibWithOwner and respondsToSelector
  • From: Robert Murley <email@hidden>
  • Date: Tue, 11 Jan 2005 11:15:52 -0800

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.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Howto receive text notifications from NSFormCells in an NSForm
  • Next by Date: NSTableView addTableColumn
  • Previous by thread: Re: Howto receive text notifications from NSFormCells in an NSForm
  • Next by thread: NSTableView addTableColumn
  • Index(es):
    • Date
    • Thread