Re: File Paths
Re: File Paths
- Subject: Re: File Paths
- From: David Remahl <email@hidden>
- Date: Sat, 23 Nov 2002 03:01:05 +0100
Seth,
Either you could do this:
NSImage *img = [NSImage imageNamed:@"AnImage.tiff"];
which will search your Resources folder for an image named AnImage.
Or you can do it like this:
NSString *imgPath = [[NSBundle mainBundle] pathForResource:@"AnImage"
ofType:@"tiff"];
NSImage *img = [[NSImage alloc] initWithContentsOfFile:imgPath];
...
[img release];
/ rgds David
On Saturday, November 23, 2002, at 02:53 AM, Seth Willits wrote:
I've looked through a bunch of tutorials and stuff and none of them
have an
example of creating a path to access a file in a bundles Resources
directory, and then open that file as an image so it can be drawn in a
view.
I know I should go buy a book on Cocoa but I'm holding off, so all I
have
are the tutorials on the web, and whatever reference and sample code I
can
dig up.
Thanks...
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >File Paths (From: Seth Willits <email@hidden>) |