• 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: "M. Uli Kusterer" <email@hidden>
  • Date: Fri, 21 Jan 2005 04:20:35 +0100

At 19:34 Uhr -0600 20.01.2005, Ricky Sharp wrote:
NSString* theImagePath = [NSBundle pathForResource:aName ofType:nil
inDirectory:[[aBundle resourcePath] stringByAppendingPathComponent:@"Images"]];


where aName is the root name of some image and aBundle is usually the result of [NSBundle mainBundle].

However, theImagePath is always nil.

This is wrong. You need to drink more black tea (or coffee, if you're so inclined) before coding. :-)


pathForResource is an instance method, IIRC, so the first NSBundle should be aBundle. 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.

I'm also not sure you're allowed to pass NIL for the type. Certainly the docs don't mention that.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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>)

  • Prev by Date: Re: Loading images from subfolder of Resources
  • Next by Date: Re: How to get text coordinates in a NSTableView
  • Previous by thread: Re: Loading images from subfolder of Resources
  • Next by thread: Re: Loading images from subfolder of Resources
  • Index(es):
    • Date
    • Thread