• 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: NSImageView and CoreData entity creation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImageView and CoreData entity creation


  • Subject: Re: NSImageView and CoreData entity creation
  • From: Chris Hanson <email@hidden>
  • Date: Sun, 18 Sep 2005 03:02:28 -0700

On Sep 17, 2005, at 8:55 AM, Eric Friedman wrote:
In my nib, there is master-detail view for Person objects.  In the
detail area, I have an NSImageView whose data binding is pointed to
selection.picture.data.

I would like users to be able to drag and drop pictures onto this
NSImageView and have that do several things at once:  (a) instantiate
a Picture; (b) set the selected Person's relationship attribute to
point to that instance; and (c) store the dropped image in the
Picture's data attribute.

Rather than subclassing a view-layer class, such as NSImageView, I'd probably do this kind of work at the model or controller layer.


If every Person has an associated Picture, I might use a custom NSManagedObject subclass to represent a Person and override - awakeFromInsert to create an associated Picture right off the bat.

Another possible strategy is to use a transient attribute on Person to represent the image data temporarily (e.g. "pictureData") and to fill this in upon fetch (via -awakeFromFetch) and save (via -willSave).

Finally, one could always introduce an intermediate controller object (not necessarily an NSController) to handle the NSImageView associated with a Person's Picture without subclassing NSImageView itself.

  -- Chris

_______________________________________________
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: NSImageView and CoreData entity creation
      • From: Eric Friedman <email@hidden>
References: 
 >NSImageView and CoreData entity creation (From: Eric Friedman <email@hidden>)

  • Prev by Date: Re: retain & release
  • Next by Date: Newbie Q : show line numbers
  • Previous by thread: NSImageView and CoreData entity creation
  • Next by thread: Re: NSImageView and CoreData entity creation
  • Index(es):
    • Date
    • Thread