• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: -viewDidMoveToWindow without subclassing? NSViewController?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: -viewDidMoveToWindow without subclassing? NSViewController?
      • From: Jerry Krinock <email@hidden>
References: 
 >-viewDidMoveToWindow without subclassing? NSViewController? (From: Jerry Krinock <email@hidden>)
 >Re: -viewDidMoveToWindow without subclassing? NSViewController? (From: Graham Cox <email@hidden>)
 >Re: -viewDidMoveToWindow without subclassing? NSViewController? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: -viewDidMoveToWindow without subclassing? NSViewController?
  • Next by Date: Re: How to control the window by cocoa
  • Previous by thread: Re: -viewDidMoveToWindow without subclassing? NSViewController?
  • Next by thread: Re: -viewDidMoveToWindow without subclassing? NSViewController?
  • Index(es):
    • Date
    • Thread