• 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: imageNamed cannot load an image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: imageNamed cannot load an image


  • Subject: Re: imageNamed cannot load an image
  • From: Artemiy Pavlov <email@hidden>
  • Date: Thu, 22 Mar 2007 11:54:18 +0200

Hello James!

Yes, that's what I thought. However, I used this code even when the image is in the main bundle:

NSString* BackgroundImageName = [[NSBundle mainBundle] pathForResource:@"SpaceOscillator.png" ofType:@"PNG"];
NSImage* BackgroundImage = [[NSImage alloc] initWithContentsOfFile:BackgroundImageName];


This did not work. But I will see how to access the sub-bundle now.


Thanks very much,

Artemiy.


On 22 Mar 2007, at 11:46 AM, James Chen wrote:

Hi,
If you're developing a loadable bundle.
[NSImage imageNamed:@"whatever"] will looking for the image file in
"mainBundle" but not your loadable bundle.
You have to use NSBundle's methods to locate your image instead.
HTH,
James Chen

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: imageNamed cannot load an image
      • From: James Chen <email@hidden>
    • Re: imageNamed cannot load an image
      • From: James Chen <email@hidden>
References: 
 >Re: imageNamed cannot load an image (From: James Chen <email@hidden>)

  • Prev by Date: How best to access application-scope objects from documents
  • Next by Date: Re: imageNamed cannot load an image
  • Previous by thread: Re: imageNamed cannot load an image
  • Next by thread: Re: imageNamed cannot load an image
  • Index(es):
    • Date
    • Thread