• 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
Finding an image like [NSImage imageNamed:] but not in bundle?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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/>


  • Follow-Ups:
    • Re: Finding an image like [NSImage imageNamed:] but not in bundle?
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: loginwindow scripts
  • Next by Date: Re: Cocoa/EOF for non-enterprise apps Re: proof of cocoa
  • Previous by thread: Notifications
  • Next by thread: Re: Finding an image like [NSImage imageNamed:] but not in bundle?
  • Index(es):
    • Date
    • Thread