Re: Displaying image and core data
Re: Displaying image and core data
- Subject: Re: Displaying image and core data
- From: Kubernan from 10191 Technologies <email@hidden>
- Date: Wed, 16 Nov 2005 23:15:19 +0100
Le 16 nov. 05 à 22:10, Scott Stevenson a écrit :
On Nov 16, 2005, at 12:24 PM, Kubernan from 10191 Technologies wrote:
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"];
[...]
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.
What is the purpose of "filesToOpen"?
It contains the path of the file selected from the open panel.
To me it seems like you're unnecessarily mixing NSImage and NSData
objects. You can just store the image itself in the binary
attribute and connect the image view's "data" binding to the
Person's "originalPicture" attribute.
My goal is to update the core data context through the controller
(not directly the core data). I thought i could use
[personalityController setValue:anImage
forkeyPath:@"selection.originalPicture"] but it doesn't work because
the core data is waiting for an NSData (binary attribute) not NSImage.
In IB My NSImageView bind Value is "Data = selection.originalPicture
[Person Array Controller(NSArrayController)]"
<snip>
- Scott
--
http://theocacao.com/
Thanks for your help,
K. _______________________________________________
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