Re: Loadable Nib Views
Re: Loadable Nib Views
- Subject: Re: Loadable Nib Views
- From: Kurt Revis <email@hidden>
- Date: Thu, 8 Nov 2001 14:38:03 -0800
The documentation on NSBundle Additions tells me how to load
the Nib, but nothing understandable on how to enumerate or access the
objects within it
You need to use the file's owner. The way from the outside of the nib to
get a pointer to an object in a nib is to create an outlet on the file's
owner and connect it to the object you want to get a pointer to.
Yes, but: somehow other classes manage to get at the top-level objects
in the nib. Two examples I can think of:
* NSWindowController will release the top-level objects in its nib when
it is deallocated
* NSApplication somehow manages to find the main menu, even if there is
no connection to it in the application's main nib
I assume the API to do this is private, right? (If so, why?)
(Now that I play around a bit, it's clear that there is something magic
about the main menu that's in the nib. I duplicated the main menu and
deleted the original one, and my app couldn't find it. Perhaps when the
main menu is unarchived, it explicitly calls [NSApp setMainMenu:self],
or something.)