Trouble binding against transient Core Data property
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