Re: -(void)windowDidLoad [was Re: (no subject)]
Re: -(void)windowDidLoad [was Re: (no subject)]
- Subject: Re: -(void)windowDidLoad [was Re: (no subject)]
- From: Tommy Knowlton <email@hidden>
- Date: Thu, 6 Jun 2002 16:44:43 -0600
Well, -(void)awakeFromNib is getting loaded, what's not reliable is when.
In certain cases, I need to remove a tab from the UI before the window
displays, and I'd like to do this in -(void)windowDidLoad, but that
isn't getting called.
-(void)awakeFromNib gets called, but the order always varies, and if I
remove a subview in the NSWindowController's -(void)awakeFromNib, I
might find that the (now removed) subview receives an
-(void)awakeFromNib message later.
Am I correct in assuming that -(void)windowDidLoad does not get sent to
NSWindowController instances that awake from a nib?
This is inconsistent with how preference panes work: I am able to rely
on -(void)mainViewDidLoad.
On the other hand, the NSPrincipalClass is the NSPreferencePane
subclass, which is also the Controller class. For the problem
application, the NSPrincipalClass is NSApplication.
I also wonder if there's not another way to do work after everything has
been loaded from the nib, but before the window is displayed, besides
-(void)windowDidLoad (since that is not working).
--Tk!
On Thursday, June 6, 2002, at 03:46 , email@hidden
wrote:
On Thursday, June 06, 2002, at 06:43PM, Tommy Knowlton
<email@hidden> wrote:
I've got a NSWindowController subclass instance in my application's
main
nib.
It's _window outlet is connected to the only NSWindow in the nib.
I need to do some processing at a time BEFORE the window is shown on
screen, but AFTER all outlets have been connected for all nib objects.
-(void)awakeFromNib does not get called reliably such that all outlets
on all nib objects have been connected.
Unfortunately, experience seems to be teaching me that
-(void)windowDidLoad does not get called for NSWindowController's that
are instantiated in the nib.
If you're finding that awakeFromNib is not getting called reliably, you
should log it as a bug. I've never had issues with this, and Apple's
documentation states:
"If you need to initialize an object after its nib file has been
loaded, create an awakeFromNib method for the object. It's called after
all nib file's objects have been loaded and all the connections have
been set up."
so, it sounds like awakeFromNib is what you want, but that there's an
issue either with Apple's framework or the structure of your nib.
_______________________________________________
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.