• 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
Re: 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]

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


References: 
 >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>)

  • Prev by Date: Fwd: NSThread call back...
  • Next by Date: Re: Sleep?
  • Previous by thread: From Main Bundle's Resource folder: How can I load similar resources (png images) from different sub-folders into their respective NSArrays?
  • Next by thread: Fwd: Pb with object release
  • Index(es):
    • Date
    • Thread