On 04/09/2008, at 9:52 PM, Oleg Krupnov wrote:

The question is: am I allowed to alter the model directly, or should I
always use the controller?


You can change the model directly, but you must use KVC-compliant methods to do so, unless you fire -willChangeValueForKey and - didChangeValueForKey in your custom method.

Normally you would use indexed accessor methods for collection types, e.g.:

- (unsigned int)countOfFoo;
- (id)objectInFooAtIndex:(unsigned int)index;
- (void)insertObject:(id)anObject inFooAtIndex:(unsigned int)index;
- (void)removeObjectFromFooAtIndex:(unsigned int)index;
- (void)replaceObjectInFooAtIndex:(unsigned int)index withObject: (id)anObject;

Have a look here:

http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#/ /apple_ref/doc/uid/20002174

--
Rob Keniger



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to