• 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: Images in bundles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Images in bundles


  • Subject: Re: Images in bundles
  • From: Raphael Sebbe <email@hidden>
  • Date: Wed, 24 Oct 2001 16:04:25 +0200

On Wednesday, October 24, 2001, at 12:19 PM, Angela Brett wrote:

theImage=[NSImage imageNamed:@"theImageName"];

which is what I've used successfully in my other projects. That didn't work (theImage was nil), which I guessed was because imageNamed looks in the main bundle of an application, and this is only a bundle by itself.

Then I tried:

theImage=[[NSImage alloc] initByReferencingFile:[[NSBundle mainBundle] pathForImageResource:@"theImageName.gif"]];

If you guessed correctly, then your second try will do exactly the same (still the main bundle). Perhaps you can try something like this to get *your* bundle's resource:

theImage=[[NSImage alloc] initByReferencingFile:[[NSBundle bundleForClass:[self class]] pathForImageResource:@"theImageName"]];

Raphael


References: 
 >Images in bundles (From: Angela Brett <email@hidden>)

  • Prev by Date: Re: Images in bundles
  • Next by Date: NSPreferencesPane.h
  • Previous by thread: Re: Images in bundles
  • Next by thread: NSPreferencesPane.h
  • Index(es):
    • Date
    • Thread