• 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: Programmatically setting a binding with an NSValueTransformer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically setting a binding with an NSValueTransformer


  • Subject: Re: Programmatically setting a binding with an NSValueTransformer
  • From: Bill Garrison <email@hidden>
  • Date: Tue, 11 Dec 2007 18:17:33 -0500


On Dec 11, 2007, at 5:00 PM, Norm Hecht wrote:

I have a CoreData app with an NSTableView, and I want the user to be able to
add and delete the columns (from a given list). I've been able to programmatically
recreate all of the columns and their bindings except the ones that use a custom
NSValueTransformer and NSPopUpButtonCell. My questions are


1) How do I bind the value transformer? I haven't been able to figure out how
from the documentation or examples on the web.

Norm,

I've done this with a named custom transformer, but it relies on you having registered your custom transformer with NSValueTransformer.

{
NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
[bindingOptions setObject:MyCustomTransformerName forKey:NSValueTransformerNameBindingOption];

[myColumn bind:@"value" toObject:someController withKeyPath:@"arrangedObjects.someValue" options:bindingOptions];
}



To just use an instance of your custom transformer...

{
	id transformer = [[[MyCustomTransformer alloc] init] autorelease];

NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
[bindingOptions setObject: transformer forKey:NSValueTransformerBindingOption];

[myColumn bind:@"value" toObject:someController withKeyPath:@"arrangedObjects.someValue" options:bindingOptions];
}


Bill
_______________________________________________

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: 
 >Programmatically setting a binding with an NSValueTransformer (From: Norm Hecht <email@hidden>)

  • Prev by Date: Re: Programmatically setting a binding with an NSValueTransformer
  • Next by Date: Re: Subclassed control in IB uses original cell class
  • Previous by thread: Re: Programmatically setting a binding with an NSValueTransformer
  • Next by thread: Parsing XML with NSXMLParser
  • Index(es):
    • Date
    • Thread