Re: -viewDidMoveToWindow without subclassing? NSViewController?
Re: -viewDidMoveToWindow without subclassing? NSViewController?
- Subject: Re: -viewDidMoveToWindow without subclassing? NSViewController?
- From: Graham Cox <email@hidden>
- Date: Thu, 16 Apr 2009 13:09:52 +1000
On 16/04/2009, at 12:59 PM, Jerry Krinock wrote:
On 2009 Apr 15, at 19:15, Graham Cox wrote:
The usual way is to implement -windowDidLoad (a NSWindowController
method) and put your code in there. This is called when the window
is first shown by the window controller, since windows are
constructed lazily.
Thanks Graham, but after trying this I discover that it suffers from
the same problem as -awakeFromNib. Indeed it runs later than -
awakeFromNib, but still not late enough because [self window] still
returns nil in views that are not in the initially-selected tab view
item.
Isn't this always going to be the case with NSTabView?
Views that are not in the currently selected tab are not in the view
hierarchy - the tab's "container" view is retained by the tab but not
added to the tab view itself unless selected, so there is no path from
any hidden view item to the window - [notShownView window] is always
nil. It doesn't matter when you call it - if it's not visible in the
selected tab you can't find the window that way.
If you need the window, the window controller will return it from -
window. I don't see why you need to get this from an item in a tab view?
You talk about the need to initialise something. What? How? What are
you trying to do?
--Graham
_______________________________________________
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