ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  The Cocoa Controller Layer
Subject:   What about "separate" data
Date:   2004-10-08 13:35:11
From:   scottellsworth
Response to: What about "separate" data

There are a couple of ways to handle this.


Likely the easiest is to create an NSArray subclass that has hooks on the accessors. When a new row is added in the interface, eventually, a new item will be added to your NSArray subclass. You can then "do what is appropriate" to get the user entered data, enter it in a database, etc. You can get as fancy as need be - watch for selection changes before commit, update the row with generated keys, etc.


Just make sure that if you programatically change any value in your NSArray behind the back of the controller, that you do one of the things that tells KVO that you made a change.


Scott