From Main Bundle's Resource folder: How can I load similar resources (png images) from different sub-folders into their respective NSArrays?
From Main Bundle's Resource folder: How can I load similar resources (png images) from different sub-folders into their respective NSArrays?
- Subject: From Main Bundle's Resource folder: How can I load similar resources (png images) from different sub-folders into their respective NSArrays?
- From: "Frederick C. Lee" <email@hidden>
- Date: Wed, 9 Nov 2005 09:38:44 -0800
Greetings:
How can I load similar resources (e.g., PNG images) stored within
different folders, into their respective arrays? I tried using the
'inDirectory' parameter based on the bundlePath but I'm not getting
any results. I don't want to use absolute paths. All I can do is
specify 'nil' and have ALL PNG images collected, regardless to their
respective folders.
Regards,
Ric.
Scenario:
/Resources
/Flag_Images
USA.png
Canada.png
...
/Misc_Images
Calcite.png
...
Desired result:
NSArray *flags = {pngs....}
NSArray *miscImages = {pngs...}
Here's a snippet of my code:
...
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.
_______________________________________________
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