• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Displaying image and core data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Displaying image and core data
      • From: Kubernan from 10191 Technologies <email@hidden>
References: 
 >Displaying image and core data (From: Kubernan from 10191 Technologies <email@hidden>)

  • Prev by Date: Re: Registration code
  • Next by Date: Re: NSOutlineView as dragging destination for promised files
  • Previous by thread: Displaying image and core data
  • Next by thread: Re: Displaying image and core data
  • Index(es):
    • Date
    • Thread