Re: Programmatic Binding KVC KVO
Re: Programmatic Binding KVC KVO
- Subject: Re: Programmatic Binding KVC KVO
- From: Kyle Sluder <email@hidden>
- Date: Wed, 4 Nov 2009 08:40:52 -0800
On Nov 4, 2009, at 6:04 AM, Richard Somers
<email@hidden> wrote:
I have a managed object context with two attached
NSObjectControllers in entity mode. Both controllers control the
same entity.
Important: do you really mean entity, or do you mean managed object?
managed object model
nib 1
controller
user interface
bind in interface builder
nib 2
controller
user interface (custom view)
bind in code programmatically
You need to describe precisely what you've done in both cases, which
includes posting your code. You also make no mention of what managed
object context your controllers are hooked up to.
Nib 1 works. Entity changes produce by the user interface show up in
the managed object model and in the custom view found in nib 2.
Here, you mean to say that managed object property changes show up in
your managed object context.
Nib 2 only partly works. Changes made in the custom view do not show
up in the managed object model or in the user interface found in nib
1.
So now we also need to see your custom view code.
When establishing a binding programmatically do you also need to
setup key value observing? I thought a binding was bi-directional
and included both key value coding and observing.
No, bindings are not directional, and only do whatever you tell them
to. NSObject's implementation of -bind:toObject:… starts observing
the specified keypath, and its implementation of -
observeValueForKeyPath:… attempts to use KVC to set a property with
the same name as the binding. 99% of the time you're going to provide
a custom implementation of both of these methods, and not calling
super's implementation.
Neither of these scenarios handles the reverse case.
--Kyle Sluder_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden