• 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: Cant Load an Image into a CALayer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cant Load an Image into a CALayer


  • Subject: Re: Cant Load an Image into a CALayer
  • From: Benjamin Stiglitz <email@hidden>
  • Date: Wed, 3 Dec 2008 10:08:56 -0500

NSImage * image = [[NSImage alloc] initByReferencingFile:@"Destroyer.png"];

Your conditional statement is failing because the image can't be located;
you need to pass the path to your image relative to the current working
directory; see the documentation:


<http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/occ/instm/NSImage/initByReferencingFile: >

If this image is in your resources directory, you can use either
[NSImage imageNamed:@"Destroyer.png"]
or
[[NSImage alloc] initByReferencingFile:[[NSBundle mainBundle] pathForResource:@"Destroyer" ofType:@"png"]]


-Ben
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Cant Load an Image into a CALayer
      • From: Gustavo Pizano <email@hidden>
References: 
 >Cant Load an Image into a CALayer (From: Gustavo Pizano <email@hidden>)

  • Prev by Date: RE: Any reason to avoid GCC-4.2 for Leopard and later targeted code?
  • Next by Date: Re: Get an Specific sublayer of a view.
  • Previous by thread: Cant Load an Image into a CALayer
  • Next by thread: Re: Cant Load an Image into a CALayer
  • Index(es):
    • Date
    • Thread