Re: devil of a time with an NSImageView
Re: devil of a time with an NSImageView
- Subject: Re: devil of a time with an NSImageView
- From: Jean-Daniel Dupas <email@hidden>
- Date: Thu, 20 Aug 2009 20:55:34 +0200
Le 20 août 2009 à 20:02, I. Savant a écrit :
On Aug 20, 2009, at 1:12 PM, Quincey Morris wrote:
a. I'm not sure how 'loadWindow' got into this discussion -- the
documentation says not to call 'loadWindow' directly but to call
'window' instead and let *it* call 'loadWindow'.
You're right, my mistake. I was responding to Jean-Daniel's message
("And the -[NSWindowController window] and -[NSWindowController
loadWindow] confirms that windowDidLoad is invoke only when the nib
has finish loading.") and got my own wires crossed.
b. 'window' won't return (presumably because an underlying
'loadNib...' doesn't return) until the NIB is completely loaded,
including all the invocations of 'awakeFromNib' and the invocation
of 'windowDidLoad'. AFAIK it's perfectly safe to invoke 'window'
immediately after creating the window controller, or even during
the window controller's init method (I've done both without
problems).
Good point.
c. A couple of weeks ago on this list, one of our Apple experts
(Luke, maybe, but I can't remember for sure) said to use the more
specialized method (such as 'windowDidLoad') *instead of* the
generic 'awakeFromNib', if the class has it.
I missed that thread. Do you happen to know some keywords from the
subject?
While I was looking for this thread, I found this old answer from an
other Cocoa expert (Chris Hanson):
http://lists.apple.com/archives/cocoa-dev/2003/Jul/msg00260.html
I'm quoting the conclusion:
“I prefer to use -awakeFromNib only to finish configuring controls
themselves, while I prefer to populate them in -windowDidLoad (or its
NSDocument equivalent). Why? Because they're conceptually two
different thing. The first is essentially to make up for a lack of
Interface Builder palettes to finish configuring your view objects --
for instance, being able to set an NSTableView's double-click action,
or configuring a data cell for a table column -- while the second
involves gluing your model objects to your view objects."
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden