Re: Images in bundles
Re: Images in bundles
- Subject: Re: Images in bundles
- From: j o a r <email@hidden>
- Date: Wed, 24 Oct 2001 15:23:25 +0200
On Wednesday, October 24, 2001, at 12:19 , Angela Brett wrote:
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"]];
That way, theImage was not nil, but [theImage isValid] returned NO.
What am I missing?
mainBundle probably refers to the bundle of the screen saver
application, not your screen saver "plugin". Try something like this
instead:
NSBundle *thisBundle = [NSBundle bundleForClass:[self class]];
NSArray *images = [thisBundle pathsForResourcesOfType:@"tiff"
inDirectory:nil];
Regards,
j o a r