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: Andreas Wolf <email@hidden>
- Date: Tue, 15 May 2001 14:55:41 -0700
> If that doesn't work, try putting an NSBox without borders or titles
on your main
> window, make it as large as the window's contentView, and then set its
> contentView to whatever view you want the user to see. That should
work (I know
> because I've done it before)
Thanks much for your help!
I tried out what you suggested but I couldn't get it to work, either.
(I also had sent the display message before)
Here is what I do:
In the bundled app I have a method
-(NSView*) getView:(id) sender
{
return [myWindow contentView]; // myWindow outlet connected to
the bundles window
}
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.
What am I doing wrong?
Thank you very much,
-Andreas