Re: changing entire content view of an NSWindow
Re: changing entire content view of an NSWindow
- Subject: Re: changing entire content view of an NSWindow
- From: Enrique Zamudio <email@hidden>
- Date: Tue, 15 May 2001 17:14:09 -0500
- Organization: Nasoft
Are you sure the nib is loading correctly? have you tried printing the NSView or something?
try something like NSLog(@"myView=%@", otherView) after getting the view. Maybe you're not
loading the nib the way you should or something.
I think the easiest way is to just call
[NSBundle loadNibNamed:@"MyNib" owner:self];
which will look for MyNib.nib on the bundle containing the class of the object passed as
owner. So the bundle in which you have the component's class should also have the nib...
Andreas Wolf wrote:
>
Now, in my real app I want to set the bundle's view to the app's window
>
content view (or NSBox contentView, or whatever)
>
>
Class componentClass;
>
id component;
>
NSView *otherView;
>
>
NSBundle *bundle = [NSBundle bundleWithPath:@"otherapp.bundle"];
>
>
if(componentClass =[bundle principalClass])
>
{
>
component = [[componentClass alloc] init];
>
>
[component loadNib:self]; // tell otherapp to load its nib
>
otherView = [component getView:nil]; // get otherapp's view
>
>
[myNSBox setContentView: otherView];
>
>
[myNSBox display];
>
}
>
>
The bundle loads correctly and it starts up, because I instantiate it,
>
but it does not display it's view in my apps view,
>
regardless of wether I set it to the windows content view or to an
>
NSBox's content view.