• 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: Displaying jpeg images (from HD)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Start & Stop demon
  • Next by Date: Some FUD for the Newbies (Was: Visualizing Cocoa)
  • Previous by thread: Re: Start & Stop demon
  • Next by thread: Some FUD for the Newbies (Was: Visualizing Cocoa)
  • Index(es):
    • Date
    • Thread