Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: best time to alter GUIs



On Mar 3, 2008, at 11:12 AM, Daniel Child wrote:

On Mar 1, 2008, at 6:15 AM, Ken Thomases wrote:

Does your init method do anything else other than calling [super initWithWindowNibName:]? In particular, if it calls [self window], that forces the loading (and awakening) of the NIB in order to reconstitute the window.
My bad. I should have checked that, and assumed it simply passed the address. If [self window] loads things, is there any way to obtain the window's address without loading it?

That question is nonsensical. There is no window until it's loaded, therefore there is nothing to have the address of.



I found it useful to assign a (superfluous) instance variable since I was doing so much with the window. I didn't want to have to use [self window] each time, especially if [self window] actually tries to load each time.

[self window] returns the window, loading it if necessary. That is, it only loads it once. This is all documented in the NSWindowController docs. You can cache this value if you want, but that's redundant since NSWindowController is already "caching" it for you. Also, you then run the risk of forcing the window to load before it's strictly necessary, as you've discovered.


Cheers,
Ken
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: best time to alter GUIs (From: Ken Thomases <email@hidden>)
 >Re: best time to alter GUIs (From: Daniel Child <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.