Re: From Main Bundle's Resource folder: How can I load similar resources (png images) from different sub-folders into their respective NSArrays?
Re: From Main Bundle's Resource folder: How can I load similar resources (png images) from different sub-folders into their respective NSArrays?
- Subject: Re: From Main Bundle's Resource folder: How can I load similar resources (png images) from different sub-folders into their respective NSArrays?
- From: Douglas Davidson <email@hidden>
- Date: Wed, 9 Nov 2005 10:53:43 -0800
On Nov 9, 2005, at 9:38 AM, Frederick C. Lee wrote:
static NSString *MISC_IMAGES = @"/Contents/Resources/Misc_Images";
static NSString *ROUND_FLAGS = @"/Contents/Resources/Round_Flags";
...
...
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
NSString *miscImages = [bundlePath
stringByAppendingString:MISC_IMAGES];
NSString *roundFlags = [bundlePath
stringByAppendingPathComponent:ROUND_FLAGS];
NSArray *flags = [[NSBundle mainBundle]
pathsForResourcesOfType:@"png" inDirectory:roundFlags]; //
Doesn't Work: Only works when iDirectory:nil.
This isn't right. The inDirectory: argument is supposed to be a
relative path from the resources directory to some subdirectory, e.g.
NSArray *flags = [[NSBundle mainBundle]
pathsForResourcesOfType:@"png" inDirectory:@"Round_Flags"]. You
don't want to use the bundlePath when looking up resources in the
bundle.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden