Skip navigation.
 
mlRe: top level objects and NSWindowController
FROM : Michael Ash
DATE : Sat Jun 24 19:57:51 2006

On 6/23/06, Ken Victor <<email_removed>> 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

Related mailsAuthorDate
mltop level objects and NSWindowController Ken Victor Jun 23, 21:26
mlRe: top level objects and NSWindowController Matt Neuburg Jun 24, 01:10
mlRe: top level objects and NSWindowController Ken Victor Jun 24, 01:20
mlRe: top level objects and NSWindowController Michael Ash Jun 24, 19:57
mlRe: top level objects and NSWindowController Ken Victor Jun 24, 21:31
mlRe: top level objects and NSWindowController Michael Ash Jun 25, 03:58