Binding to a model class
Binding to a model class
- Subject: Binding to a model class
- From: Don Rainwater <email@hidden>
- Date: Fri, 30 Apr 2004 15:42:22 -0400
Definitions:
1. MyDocument - the document class
2. MyModel - a model class
3. myArray - an array, defined in MyModel to contain MyRecord objects
4. MyRecord - the data object
I'm trying to bind an NSArrayController to myArray in MyModel, ala
Vermont Recipes VRTextFieldModel class, but I'm missing something. The
contentArray for the controller is bound to File's Owner, and the model
key path is set to myArray. Attributes/Object Class Name on the
controller is set to MyRecord, and keys are defined to match the
variables in MyRecord. When I build and run, I get an error message
about the document class not complying with key-value coding.
If I define myArray and it's methods (myArray, setMyArray,
insertObject:inMyArrayAtIndex, removeObjectFromMyArrayAtIndex) in the
document class, it works. But I like the idea of setting it up in a
separate model class. Do I need to implement the insert... and
remove... methods in MyDocument instead of MyModel, or am I missing
something else?
As is probably evident, I'm a relative newbie to Cocoa programming,
especially where bindings are concerned. Thanks for any help.
--
Don
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.