Re: imageNamed cannot load an image
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