Re: Accessing Resources
Re: Accessing Resources
- Subject: Re: Accessing Resources
- From: Paul Lynch <email@hidden>
- Date: Mon, 17 Apr 2006 20:17:45 +0100
On 17 Apr 2006, at 20:10, Bobby B wrote:
I have a quick question. I've added some images to my program, via
"Add Existing Files to Project", and they are listed under my
resources. How do I access these in my program? I need to access
them as [myImage initWithContentsOfFile:@""];. I try using just their
filename, and the program crashes. But, if I use their absolute path
("/users/Me/Development/ProgramName/imagename.tif") it works fine.
But obvioulsy I can't hard-code that path in the program.
eg
NSString *imagePath = [[NSBundle mainBundle]
pathForResource:@"imagename" ofType:@"tiff"];
Paul
_______________________________________________
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