• 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: How To Unbind
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How To Unbind


  • Subject: Re: How To Unbind
  • From: Richard Somers <email@hidden>
  • Date: Mon, 31 Aug 2009 12:40:26 -0600

On Aug 31, 2009, at 7:05 AM, Klaus Backert wrote:

Have you tried the constant NSManagedObjectContextBinding defined in NSKeyValueBinding.h instead of your constant @"managedObjectContext"? I don't know, but may be NSManagedObjectContextBinding does not contain this string.

The problem was unbind was insufficient to de-couple the controller from its content binding. The controller content must also be set to nil. (Refer to Apple Cocoa Bindings Programming Topics, Providing Controller Content, De-coupling a Controller from its Content Bindings.) Also using NSManagedObjectContextBinding rather than @"managedObjectContext" for the controller as suggested is cleaner.


Part of the problem here is that the documentation (Apple Cocoa Bindings Reference) for NSArrayController lists the managedObjectContext under "Parameters Bindings". You would think that it should be listed under "Controller Content Bindings" or "Controller Content Parameters Bindings" because it provides controller content.

Here is the code that works.

     NSArrayController *controller;

Establish a binding programmatically.

     [controller bind:NSManagedObjectContextBinding
             toObject:self
          withKeyPath:@"managedObjectContext"
              options:nil];

Unbind programmatically.

     [controller unbind:NSManagedObjectContextBinding];
     [controller setManagedObjectContext:nil];

Richard

_______________________________________________

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


References: 
 >How To Unbind (From: Richard Somers <email@hidden>)

  • Prev by Date: Re: 10.6: Check Box Cells in NSTableViews always editable!
  • Next by Date: Re: Handling international text without text views
  • Previous by thread: How To Unbind
  • Next by thread: How to use NSTextView's new -checkTextInRange:types:options:?
  • Index(es):
    • Date
    • Thread