Re: Displaying jpeg images (from HD)
Re: Displaying jpeg images (from HD)
- Subject: Re: Displaying jpeg images (from HD)
- From: Stefano Tripi <email@hidden>
- Date: Mon, 11 Jun 2001 22:27:10 +0200
Here is some sample code to open an image with an OpenPanel and display
it in an NSImageView.
//----Start Code----
//myImageView is an outlet to an NSImageView, connected in Interface
Builder..
int result;
NSOpenPanel *op;
op = [NSOpenPanel openPanel];
result = [op runModalForTypes:[NSArray arrayWithObject:@"JPG"]];
//You can also specify an Array with several objects (TIFF, GIF...)
if (result == NSOKButton) {
NSImage *img = [[NSImage alloc] initWithContentsOfFile:myFourthString];
[myImageView setImage:img];
[img release];
}
//----End Code----
Hope this helps.
Bye
----------------
Stefano Tripi -Mac developer-
http://www.stetripi.com/
ICQ: 37838014
----------------
"Think Different." Apple Computers