• 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: Gustavo Pizano <email@hidden>
  • Date: Fri, 5 Dec 2008 20:06:52 +0100

Aha ok.. Thanks

I think I did it now.

Gus

On 3.12.2008, at 16:08, Benjamin Stiglitz wrote:

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

_______________________________________________

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


References: 
 >Cant Load an Image into a CALayer (From: Gustavo Pizano <email@hidden>)
 >Re: Cant Load an Image into a CALayer (From: Benjamin Stiglitz <email@hidden>)

  • Prev by Date: Re: New to Cocoa and Objective C, and I need some basic pointers
  • Next by Date: Re: How does MainMenu.xib get loaded in a Cocoa application?
  • Previous by thread: Re: Cant Load an Image into a CALayer
  • Next by thread: Re: Cant Load an Image into a CALayer Solved
  • Index(es):
    • Date
    • Thread