• 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: top level objects and NSWindowController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: top level objects and NSWindowController


  • Subject: Re: top level objects and NSWindowController
  • From: Ken Victor <email@hidden>
  • Date: Sat, 24 Jun 2006 12:31:31 -0700

mike,
thanx for the response. sorry, but i can't see how to make this work! if i did override loadWindow and used NSNib, then how would the NSWindowController find out about the top level object in order to release them? or would i have to keep track of them myself and then release them at the appropriate time? if this is the case, its probably just as easy to have my custom views simply "register themselves" with my controller at awakeFromNib time.


thanx anyway,
ken


Date: Sat, 24 Jun 2006 13:57:51 -0400
From: "Michael Ash" <email@hidden>
Subject: Re: top level objects and NSWindowController
To: email@hidden
Message-ID:
	<email@hidden>
Content-Type: text/plain; charset=UTF-8; format=flowed

On 6/23/06, Ken Victor <email@hidden> wrote:
 other than by using outlets, is it possible to gain access to the top
 level objects in a nib file loaded via an NSWindowController?

 i would like to place several custom views in a nib (to be used as
 various panes in a tab view), and i would like programmatically to
 determine how many of them there are and get pointers to them when i
 load the window.

 i realize i could switch to using NSNib instead of
 NSWindowController, but i really really want to use
 NSWindowController.

 also, i realize i can do this by using outlets, but that means
 editting my source code every time i add another custom view. i also
 realize that i could add an outlet to my custom views to point to a
 controller in the nib, and then "register" the custom views in
 awakeFromNib, but that seems like an extra step if i could simply get
 the array of top level objects from NSWindowController.

There doesn't seem to be a direct way, and so you'll have to use NSNib. However, it's not an either-or choice. You can override loadWindow to do your own loading. You'll have to replace the method entirely and not call super, but what it does is well-documented enough and NSWindowController provides enough support methods that a total reimplementation should only be a few lines long.

Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: how do I put an object in a dictionary, change the object but leave the dict untouched?
  • Next by Date: Re: how do I put an object in a dictionary, change the object but leave the dict untouched?
  • Previous by thread: Re: top level objects and NSWindowController
  • Next by thread: Re: top level objects and NSWindowController
  • Index(es):
    • Date
    • Thread