Re: Swapping contents of windows from nibs
Re: Swapping contents of windows from nibs
- Subject: Re: Swapping contents of windows from nibs
- From: Erik Buck <email@hidden>
- Date: Thu, 8 Nov 2007 07:16:19 -0800 (PST)
One approach is to use a tab-less tab view to hold all of your different "contents" in one window and just programatically switch tabs.
However, assuming there is some reason you want to define "contents" in different windows (perhaps to keep different "contents" in different nibs), I must ask the following questions:
Where have you looked in the documentation ?
Do you have some objection to using the following: ?
-(id) contentView and
-(void) setContentView:(NSView*) aView
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/setContentView:
Try this (written in Mail):
- (void)setContentOfWindow:(NSWindow *)destinationWindow usingSourceWindow:((NSWindow *)sourceWindow
{
id contentView = [[sourceWindow contentView] retain]; // get the content view
// remove the view from its window because a single view cant be in two windows at once
[contentView setContentView:[[[NSView alloc] initWithFrame:NSZeroRect] autorelease]];
// replace the content of destinationWindow
[destinationWindow setContentView:contentView];
[contentView release];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden