Burnt by Implicit Overloading (poor naming / thinking on my part)

I’m trying to load a NSPanel with a controller that inherits from NSWindowController. So my controller’s init calls:

    self = [super initWithWindowNibName:@"NibNameHere"];

and then I call showWindow on my now init’d controller object. All pretty straight forward. Problem is that the dang “window” assigned to files owner wasn’t showing up. Well, to make a painful story short, the problem was that I stupidly wrote a ‘window’ method myself which overrode NSWindowController’s window method and understandably confused/broke things. Not sure what I was thinking, probably something like “oh, I need that ‘window’ reference elsewhere, I must need a – (NSPanel *) window, let me just create that now”. Nuked the – window and all was better in the world. It’s been a tough 24 hours.

The lesson learned? If you’re panel or window isn’t showing up when you run initWithWindowNibName / showWindow, make sure you haven’t overloaded any of your base class implementations with a wrong one of your own. Although, 90% of the time it probably just means you didn’t set ‘window’ for your Files Owner in IB.

Leave a Reply


© 2006-2009 roobasoft, LLC