• 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
Trouble binding against transient Core Data property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble binding against transient Core Data property


  • Subject: Trouble binding against transient Core Data property
  • From: Rick Mann <email@hidden>
  • Date: Sun, 10 Oct 2010 18:55:52 -0700

I have a Core Data Entity called VisualizationPlugIn, and a class to go with it. This Entity declares these properties:

NSString* 	shadowFrame;
NSRect		frame;		//  transient

and implements the getter and setter for frame as you would expect, converting the rect to/from an NSString, and calling will/didAccess/ChangeValueForKey.

When one of these is instantiated, it can also create an NSViewController subclass and view hierarchy that gets added to a window. When that happens, I programmatically bind the plug-in's top-level view's frame to the plug-in's frame Core Data property. This all seems to work. If the user re-positions the view hierarchy in the window, Core Data properly saves and restores that frame.

But Undo doesn't work. If I move the plug-in's view around, I can see that the context gets dirty (the close button in the window fills in), but if I undo, the view isn't moved back, and the context doesn't get clean.

So I thought Core Data must be undoing the shadowFrame property, and no one's getting notified. To the VisualizationPlugIn class, I added

+ (NSSet*)
keyPathsForValuesAffectingFrame
{
    return [NSSet setWithObject: @"shadowFrame"];
}

But it never gets called.

Any idea what I should be doing instead? Thanks!

--
Rick

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Trouble binding against transient Core Data property
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Identifying Cocoa Methods
  • Next by Date: Re: Trouble binding against transient Core Data property
  • Previous by thread: [Q] How to handle mouseDown when PDFView is in full screen mode?
  • Next by thread: Re: Trouble binding against transient Core Data property
  • Index(es):
    • Date
    • Thread