Re: Displaying image and core data
Re: Displaying image and core data
- Subject: Re: Displaying image and core data
- From: Justin Burns <email@hidden>
- Date: Wed, 16 Nov 2005 15:08:35 -0800
Pardon the errant semicolon in my original email, that should be:
[personalityController setValue:[NSArchiver
archivedDataWithRootObject:anImage]
forKeyPath:@"selection.originalPicture"]
Not that you couldn't have figured that out, I just couldn't let a
syntax error go uncorrected :)
-justinb
On Nov 16, 2005, at 3:04 PM, Justin Burns wrote:
Have you tried setting NSUnarchiveFromData as your Value
Transformer in the Data bindings pane?
It seems like this would do exactly what you need, assuming you
generated your original data with something like:
[personalityController setValue:[NSArchiver
archivedDataWithRootObject:anImage];
forKeyPath:@"selection.originalPicture"]
-justinb
On Nov 16, 2005, at 12:24 PM, Kubernan from 10191 Technologies wrote:
Hello,
I have a core data entity called "Person" with a binary attribute
("originalPicture") for storing picture of a person.
In my GUI i have an NSImageView binds to orginalPicture for
displaying the person's picture.
In my code, when the user choose a picture from an open file panel
i thought i could do that :
anImage = [[NSImage alloc] initWithContentsOfFile:[filesToOpen
objectAtIndex:0]];
[personalityController setValue:anImage
forKeyPath:@"selection.originalPicture"];
Of course, it doesn't work : the console says :
Unacceptable type of value for attribute: property =
"originalPicture"; desired type = NSData; given type = NSImage;
value = NSImage 0x34a000 Size={640, 480} Reps=(
NSBitmapImageRep 0x340bb0 Size={640, 480}
ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=24 Pixels=640x480
Alpha=NO Planar=NO Format=0
).
If i do :
[personalityController setValue:[NSData dataWithContentsOfFile:
[filesToOpen objectAtIndex:0]]
forKeyPath:@"selection.originalPicture"];
I have this message :
NSImageCell's object value must be an NSImage.
So what should i do for storing a picture with core data and
displaying it in my GUI ?
I read the apple document about binding and viewing image but i
don't know if it's the good
solution to my problem.
Thanks,
K
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40shipwreckbeads.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40shipwreckbeads.com
This email sent to email@hidden
_______________________________________________
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