Re: Loading an NSView instance from a Nib in a bundle
Re: Loading an NSView instance from a Nib in a bundle
- Subject: Re: Loading an NSView instance from a Nib in a bundle
- From: Patrick Gostovic <email@hidden>
- Date: Thu, 9 Oct 2003 15:11:56 -0400
Nevermind. I figured it out. In case anyone is interested...
NSBundle *bundle = [NSBundle
bundleWithPath:@"/PathToBundle/TheBundle.bundle"];
if([bundle load])
{
NSString *nibPath = [bundle pathForResource:@"NibFilename"
ofType:@"nib"];
NSDictionary *context = [NSDictionary dictionaryWithObject:self
forKey:@"NSOwner"];
[NSBundle loadNibFile:nibPath externalNameTable:context
withZone:[self zone]];
}
Also, I created an outlet from File's Owner to my NSView sublclass
instance in the nib which is in the bundle. So, each time the above
code is executed, the outlet in my main app gets pointed to fresh
instance of the NSView subclass. I'll leave the object releasing as an
exercise :).
Patrick
On Thursday, October 9, 2003, at 01:46 PM, Patrick Gostovic wrote:
>
Hi.
>
>
I've created a bundle that contains a Nib file and the custom classes
>
that go along with the Nib file. The Nib has one NSView subclass
>
instance with a few outlets to various subviews like buttons, text
>
fields, etc. My first question is is it possible to include that
>
bundle in some app and generate instances of that NSView subclass with
>
the connectors intact? My second question is, how?
>
>
Thanks
>
>
Patrick
>
_______________________________________________
>
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.
_______________________________________________
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.