FROM : Ken Thomases
DATE : Mon Mar 03 20:05:20 2008
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
DATE : Mon Mar 03 20:05:20 2008
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
| Related mails | Author | Date |
|---|---|---|
| Daniel Child | Feb 29, 06:04 | |
| Quincey Morris | Feb 29, 09:04 | |
| Ken Thomases | Mar 1, 12:15 | |
| Daniel Child | Mar 3, 18:12 | |
| Ken Thomases | Mar 3, 20:05 | |
| Quincey Morris | Mar 3, 20:05 | |
| Daniel Child | Mar 8, 04:38 | |
| Ken Thomases | Mar 8, 07:11 | |
| Daniel Child | Mar 12, 16:45 | |
| Ken Thomases | Mar 13, 00:54 |






Cocoa mail archive

