• 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
Binding to a model class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Binding to a model class
      • From: Fritz Anderson <email@hidden>
    • Re: Binding to a model class
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: setHidden: on MacOS 10.2
  • Next by Date: Re: Location from System Preferences
  • Previous by thread: Re: Passing a click to a background app without activating it?
  • Next by thread: Re: Binding to a model class
  • Index(es):
    • Date
    • Thread