• 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
windowDidLoad Not Called
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

windowDidLoad Not Called


  • Subject: windowDidLoad Not Called
  • From: "Mike Sheffield" <email@hidden>
  • Date: Sun, 11 Apr 2004 01:04:40 -0500

Hi,

I have a trivial problem that I'm sure someone will be able to identify quickly, but is driving me mad. I have a simple (non document-based) Cocoa application. It has one window that is displayed when the window starts. I have an NSWindowController subclass instantiated in my nib file, and this class is set to be the controller for the main window. All I want is to override windowDidLoad to add some initialization code. I added this function to my subclass, but it is never called, and it is not clear to me at all why this would be the case. I believe I have all my connections setup properly in IB.

While trying to inspect this situation, I added this line to my controller's init method.

if(self = [super initWithWindowNibName:@"MainMenu"]) {
array = [[NSMutableArray alloc] init];
NSLog(@"window: %@", [self window]);
}

The call to [self window] causes the windowDidLoad method to be called. After this method exits, the controller's init method is called again. When it once again executes the [self window] method, windowDidLoad is called, after which init runs again. And so on. If I comment out the NSLog line, windowDidLoad is never called.

Does anyone have an explanation for what I'm observing? I have to confess I'm completely stumped.

Thanks,
Mike

_________________________________________________________________
Persistent heartburn? Check out Digestive Health & Wellness for information and advice. http://gerd.msn.com/default.asp
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: windowDidLoad Not Called
      • From: Scott Anguish <email@hidden>
    • Re: windowDidLoad Not Called
      • From: James Spencer <email@hidden>
  • Prev by Date: Re: NSBrowser headache
  • Next by Date: XCode ObjC preprocessing plug in?
  • Previous by thread: Re: NSBrowser headache
  • Next by thread: Re: windowDidLoad Not Called
  • Index(es):
    • Date
    • Thread