• 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: Loading images from subfolder of Resources
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading images from subfolder of Resources


  • Subject: Re: Loading images from subfolder of Resources
  • From: Ricky Sharp <email@hidden>
  • Date: Fri, 21 Jan 2005 06:15:13 -0600

On Thursday, January 20, 2005, at 09:49PM, M. Uli Kusterer <email@hidden> wrote:

>At 21:33 Uhr -0600 20.01.2005, Ricky Sharp wrote:
>>>Second, pathForResource is there for building the path, why would
>>>you pass the path to your image folder and the file name to
>>>NSBundle??? Just pass the name there instead.
>>
>>When the images lived directly inside of the Resources folder, just
>>passing the name was good enough.   From my original post, I had
>>mentioned I used pathForResource:ofType:.  But now, I'm placing
>>images in subfolders.  Because I don't always know the extension,
>>that's why I need to pass the root name of the image along with the
>>folder that they live in.  Furthermore, these functions do not
>>recurse into any subfolders; that's why I need to specify the exact
>>folder to look in.
>
>  You're not understanding me. You're not just passing a folder name,
>you're passing: [[aBundle resourcePath]
>stringByAppendingPathComponent:@"Images"], which is a full pathname.
>My guess would be that's why it doesn't work.

I apologize for not being clearer in the original e-mail.  I had tried both a relative path (just passing in "Images") and the full path.  In both cases the returned path was nil.

>>>I'm also not sure you're allowed to pass NIL for the type.
>>>Certainly the docs don't mention that.
>>
>>The docs do mention that nil (or the empty string) can be used.
>>This instructs the method to search for the first resource that
>>matches the name, regardless of extension.
>
>  Huh? You're right. I don't know how I overlooked that. Sorry for
>claiming something wrong.

No problem :)  There are many similiarly named APIs regarding resource loading.

Andreas has since duplicated the problem.  I didn't have a chance to write up a bug last night, but will do today.  I'll first create a small sample project that outlines the problems.  I also plan to see just what combinations of parameters cause the APIs to fail.  Might as well log all the problems at once.  So far, I know that both the class-based and instance-based flavors of the API fail when ofType is set to nil.

--
Rick Sharp
Instant Interactive(tm)

 _______________________________________________
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: Loading images from subfolder of Resources
      • From: Ricky Sharp <email@hidden>
References: 
 >Loading images from subfolder of Resources (From: Ricky Sharp <email@hidden>)
 >Re: Loading images from subfolder of Resources (From: "M. Uli Kusterer" <email@hidden>)
 >Re: Loading images from subfolder of Resources (From: Ricky Sharp <email@hidden>)
 >Re: Loading images from subfolder of Resources (From: "M. Uli Kusterer" <email@hidden>)

  • Prev by Date: Re: Multiple controllers vs multiple categories (or tips for large projects)
  • Next by Date: Re: Why do "loose" nibs take precedence over nibs in .lproj?
  • Previous by thread: Re: Loading images from subfolder of Resources
  • Next by thread: Re: Loading images from subfolder of Resources
  • Index(es):
    • Date
    • Thread