Re: Loadable Nib Views
Re: Loadable Nib Views
- Subject: Re: Loadable Nib Views
- From: Henri Lamiraux <email@hidden>
- Date: Thu, 8 Nov 2001 14:05:40 -0800
On Thursday, November 8, 2001, at 01:42 PM, Steve Bennett wrote:
>
Will this work? Does the Nib file maintain details about the class
>
interface structure, or does it just maintain a list of outlet and
>
action
>
names, and compare that against the actual class implementation in the
>
application which loads it?
>
IB maintains its own class description within the nib. At runtime we
don't really check. Lets say you have deleted an outlet in your code but
not in the nib we will still try to connect it. It will simply fail. For
example even the class name of the file's owner doesn't really matter.
If in IB you said the files's owner if of class A but at runtime you
pass me an instance of class B (a completely different class) the
runtime will happily try to set up the outlets and actions. If will work
just fine if class B has the same outlets and actions than class A...
>
2) If my application knows the Nib filename containing a view and the
>
name
>
of a view within that file, how does it get the pointer to the actual
>
view
>
object? 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, and I've done a Google search but came up with nothing
>
better.
>
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.
Henri Lamiraux
Engineering Manager
User Interface Tools Group
Apple