• 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
Re: Programmatic Binding KVC KVO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Programmatic Binding KVC KVO
      • From: Richard Somers <email@hidden>
References: 
 >Programmatic Binding KVC KVO (From: Richard Somers <email@hidden>)

  • Prev by Date: NSPopUpButton, Bindings & separator items
  • Next by Date: Re: NSPopUpButton, Bindings & separator items
  • Previous by thread: Programmatic Binding KVC KVO
  • Next by thread: Re: Programmatic Binding KVC KVO
  • Index(es):
    • Date
    • Thread