• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
From Main Bundle's Resource folder: How can I load similar resources (png images) from different sub-folders into their respective NSArrays?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • 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>
  • Prev by Date: Searchfield pop-up menu - sorting of predicates by title?
  • Next by Date: Re: Sleep?
  • Previous by thread: Searchfield pop-up menu - sorting of predicates by title?
  • Next by thread: Re: From Main Bundle's Resource folder: How can I load similar resources (png images) from different sub-folders into their respective NSArrays?
  • Index(es):
    • Date
    • Thread