Re: Cant Load an Image into a CALayer
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