Re: Images in bundles
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