Re: Displaying image and core data
Re: Displaying image and core data
- Subject: Re: Displaying image and core data
- From: Scott Stevenson <email@hidden>
- Date: Wed, 16 Nov 2005 13:10:37 -0800
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"?
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.
If you want to store the files outside of the database, store the
path as an nsstring attribute and use image view's "valuePath" binding.
Bottom line: you shouldn't have to manually create NSImage objects.
- Scott
--
http://theocacao.com/
_______________________________________________
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