Re: Help Loading Auxiliary Nibs files
Re: Help Loading Auxiliary Nibs files
- Subject: Re: Help Loading Auxiliary Nibs files
- From: "David P. Henderson" <email@hidden>
- Date: Wed, 1 Aug 2001 16:50:17 -0400
On Wednesday, August 1, 2001, at 02:03 , Adrian Ridner wrote:
>
I derive all my controllers from a common object subclass of
>
NSWindowController that has this code in init (and I keep the naming of
>
the controller object the same as the nib file:)
>
>
- (id) init {
>
>
// Continue the designated initializer chain:
>
[super init];
>
>
// here's a fuller invocation of "loadNibNamed:" which shows the
>
loading of the
>
// dictionary with the key-value pair NSOwner, which has a value of
>
"self".
>
[NSBundle loadNibFile:[[NSBundle mainBundle]
>
pathForResource:NSStringFromClass([self class])
>
ofType:@"nib"]
>
externalNameTable:[NSDictionary
>
dictionaryWithObjectsAndKeys:self, @"NSOwner", nil]
>
withZone:[self zone]];
>
>
// place other initialization code here
>
return self;
>
>
}
>
Firstly, if the above init is in an NSWindowController subclass, the
NSWindowController docs state that you should invoke super with one of
the following initializers: initWithWindowNibName:;
initWithWindowNibName:owner:; initWithWindow:. Secondly, loadNibFile is
expecting the name of the nib file sans extension not a path which is
what you're passing it. Try [super
initWithWindowNibName:NSStringFromClass([self class]) owner:self]
instead.
You should take a look at the source for Sketch as it uses shared
NSWindowController subclass instances to implement its tools panel,
preferences panel, info panel and grid panel.
Dave
--
Chaos Assembly Werks
"Suburbia is where the developer bulldozes out the trees, then names the
streets after them."
- Bill Vaughn