• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Swapping the contents of views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swapping the contents of views


  • Subject: Re: Swapping the contents of views
  • From: Stefan Pantke <email@hidden>
  • Date: Mon, 26 Jan 2004 00:03:27 +0100

If you have a preconfigured view, e.g. in some window in your NIB, and
want to replace the contents of the template window in your current window,
your might use something like this:

>>>
- (void) adoptView: (int) viewID inWindow: (NSWindow*) theWindow {
NSRect resultFrame;
NSView *newView;

// [self setTitle:@"New Document"];
resultFrame = [theWindow frame];


switch( viewID ) {
case 1:
newView = view1OL;
break;
... probably other views ...
default:
NSLog( @"ViewerWindow->adoptView: Illegal View ID!" );
return;
}
NSRect viewFrame = [newView frame];
resultFrame.origin.y += resultFrame.size.height-viewFrame.size.height;
resultFrame.size = viewFrame.size;
// oldRect.origin.y = 0;
[theWindow setFrame:resultFrame display:YES animate:YES];
[theWindow setContentView: [[newView contentView] retain]];
}
<<<

Regards,
Stefan

Am 25.01.2004 um 23:35 schrieb email@hidden:

Hello Nice Cocoa List People:

Sorry if this a stupid RTFM question, but...

I have an application that needs to display different types of media in the same view (e,g, first a JPEG, then a QuickTime movie, then maybe an EPS file, etc.). I know how to get an image to display in an NSImageView, and how to display a movie in an NSMovieView etc.

What I want to know is how I can replace what's drawn on-screen in the same area. The area would be the same size, so I assume it's a question of creating offscreen panels containing each of the views I need (i.e. and NSImageView, an NSMovieView, etc.), intializing the panel with the data, then getting the contents of the panel to draw in the other view.

Am I on the right track? Could some kind soul point me to some sample code somewhere, or provide a code snippet.

Any help greatly appreciated.

John
_______________________________________________
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.

References: 
 >Swapping the contents of views (From: email@hidden)

  • Prev by Date: Re: Swapping the contents of views
  • Next by Date: problem with sqlite in my final application
  • Previous by thread: Re: Swapping the contents of views
  • Next by thread: Re: Swapping the contents of views
  • Index(es):
    • Date
    • Thread