Finding an image like [NSImage imageNamed:] but not in bundle?
Finding an image like [NSImage imageNamed:] but not in bundle?
- Subject: Finding an image like [NSImage imageNamed:] but not in bundle?
- From: Matt Ridley <email@hidden>
- Date: Fri, 15 Jun 2001 01:23:27 +0100
Hi folks,
I need to create a new NSImage with the contents of an image file - but the
catch is that I don't know in advance what type of image the file is, so I
don't know the file-extension (.jpg or .tiff or whatever). Thus, I can't
construct a full path to pass to [myNSImage initWithContentsOfFile:].
If the image was in my app's bundle, this wouldn't be a problem; I could
just use [NSImage imageNamed:@"MyFilenameWithoutExtension"] and it would
find the appropriate image. However, my image is not in the app bundle; it's
in a specific directory on disk (which I know the location of).
Is there a way I can get this nice imageNamed functionality for images
outwith the bundle, without having to manually loop through all possible
image file-extensions using stringByAppendingString:@".tif", and so on?
Thanks. :-)
Best,
-Matt
--
Matt Ridley
Scotland Software
<
http://www.scotlandsoftware.com/>