Re: NSEditor, NSEditorRegistration Protocols
Re: NSEditor, NSEditorRegistration Protocols
- Subject: Re: NSEditor, NSEditorRegistration Protocols
- From: Dustin Voss <email@hidden>
- Date: Tue, 2 Mar 2004 22:46:02 -0800
On 2 Mar, 2004, at 5:49 PM, Alan Donsky wrote:
Anybody know about these informal protocols? I am trying to
implement an NSView subclass that uses bindings and i think these
protocols are involved in telling the controller that the view has
changed so it can update the model.
It seems like a sloppy implementation, and the online documentation
sucks. How is the view even supposed to send the message to the
controller without having an outlet to that controller?
These protocols work in conjunction with the rest of Cocoa Binding and
key-value observing. I believe that, in order to use bindings, your
view needs to implement the NSKeyValueBindingCreation protocol.
Your view's bind:toObject:withKeyPath:options: method will be called to
set up the binding. You'll get an object and a key path. They are the
model, as far as your view is concerned. They could be a genuine model
object, or something exposed by a controller.
Your view will need to observe the key path to know if the model
changes. When your view wants to make a change, it should call
setValue:forKey: on the model object.
_______________________________________________
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.