Re: Nib loading and the externalNameTable: thing
Re: Nib loading and the externalNameTable: thing
- Subject: Re: Nib loading and the externalNameTable: thing
- From: James Quick <email@hidden>
- Date: Tue, 22 Jul 2003 12:35:28 -0400
On Thursday, July 17, 2003, at 08:51 PM, Sailor Quasar wrote:
I've sent this before and gotten no answer; I intend to try once more.
Does Anyone know anything about this?
In NSNibLoading.h, a category of NSBundle declares the following nib
loading methods:
+ (BOOL)loadNibFile:(NSString *)fileName
externalNameTable:(NSDictionary *)context withZone:(NSZone *)zone;
+ (BOOL)loadNibNamed:(NSString *)nibName owner:(id)owner;
loadNibNamed:owner: is documented specifically as being similar to
loadNibFile:externalNameTable:withZone: using an NSDictionary with a
single key of NSOwner.
Now, I'm trying to pass a string of data to an object instantiated
inside a nib that I don't have a direct reference to (no outlet for it
in the file's owner). I could create the outlet to make it available,
but first I want to know if there's a way to get this string to the
object in its -awakeFromNib method. So I'm looking at this and I say,
"hmm, an NSDictionary that's used for loading the nib. Can I use
this?". I proceeded to search the developer docs for any reference
whatsoever to the usage of the externalNameTable. Nothing. So I'm
asking: can this dictionary be accessed from an awakened object's
-awakeFromNib method, and if so can I specify a custom key/value pair
along with NSOwner in that dictionary?
NSBundle is an abstract layer on top of that stuff. It does not
document that method for
use by end users, so you should avoid it. If I were you I would use
documented interfaces.
However, I strongly suggest that you take a step back and look at your
design.
In MVC, you should be separating your interface from the rest of your
design.
The object acting as the controller for the nib contents is the only
logical place to
maintain the information needed for updating the interface element.
If the controller has no means knowing what this information is, it
should
ask the model to provide the value.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.