Re: NSImageRep Trouble
Re: NSImageRep Trouble
- Subject: Re: NSImageRep Trouble
- From: Seth Willits <email@hidden>
- Date: Sat, 23 Nov 2002 07:37:18 -0800
On 11/22/02 7:06 PM, the NSA intercepted the following message from "David
Remahl" <email@hidden>:
>
Here you need the full path to the image.
>
>
NSString *path = [[NSBundle mainBundle] pathForResource:@"Image"
>
ofType:@"tiff"];
>
imageRep = [[NSImageRep imageRepWithContentsOfFile:path] retain];
Darn. I just can't get this to work:
- (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"Image"
ofType:@"tiff"];
image = [[[NSImage alloc] initWithContentsOfFile:path] retain];
imageRep = [[image bestRepresentationForDevice:nil] retain];
...
return self;
}
- (void)animateOneFrame
{
...
[imageRep drawAtPoint:point];
return;
}
Each time, imageRep is nil and nothing is drawn. I tried to get the file and
draw it with only an imageRepresentation but that didn't work so I tried
using and NSImage to get and NSImageRep that was valid, but this is still
not working,
I appreciate the help,
Seth Willits
---------------------------------------------------------------------------
President and Head Developer of Freak Software -
http://www.freaksw.com
Q&A Columnist for REALbasic Developer Magazine -
http://www.rbdeveloper.com
"If God did not exist, it would be necessary to invent Him."
-- Voltaire
---------------------------------------------------------------------------
_______________________________________________
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.