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: 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