Changing the model behind contoller's back?
Changing the model behind contoller's back?
- Subject: Changing the model behind contoller's back?
- From: "Oleg Krupnov" <email@hidden>
- Date: Thu, 4 Sep 2008 14:52:12 +0300
I am experimenting with Core Data model bound to NSTreeController
bound to a custom view.
When I change the model via controller like this:
Widget* newWidget = [NSEntityDescription
insertNewObjectForEntityForName:@"Widget" inManagedObjectContext:[self
managedObjectContext]];
NSUInteger path[2] = {0, 0};
[widgetTreeController insertObject:newWidget
atArrangedObjectIndexPath:[NSIndexPath indexPathWithIndexes:path
length:2]];
then the custom view receives a change notification via its binding,
but when I modify the model directly,
[[self rootWirdget] addChildWidgetsObject:newWidget];
where addChildWidgetsObject: is a dynamic mutator accessor, i.e.
there's only declaration in my project, and the implementation is
provided by Core Data.
then the binding in the custom view is not fired.
The question is: am I allowed to alter the model directly, or should I
always use the controller?
I think that I should be allowed to alter the model directly, because
the model can be manipulated via Apple Script etc. But what can be the
problem then?
_______________________________________________
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