Skip navigation.
 
mlRe: Bindings + contents of an array. No dice, for newb.
FROM : Mike Abdullah
DATE : Wed Apr 04 16:21:59 2007

Hi Shamyl, having seen your screenshots, I see what the issue is.

You are correctly observing the array itself so that KVO 
notifications get sent that an object has been added or removed from 
the array.  However, notice this method:

[self setKeys:
       [NSArray arrayWithObjects:
           @"values",
           @"values.value",
           nil]
       triggerChangeNotificationsForDependentKey: @"output"];

It's "keys" not "keyPaths" , so you can't have the @"values.value" 
work correctly.

What I suggest you do instead, is bind your text field to 
values.value.  Calling [-valueForKeyPath: @"values.value"] wo;; 
return an NSArray of NSStrings.

You want to add these strings together, so write an 
NSValueTransformer whose -transformedValue: method looks something 
like this:

- (id)transformedValue:(id)value
{
   return [value componentsJoinedByString:@", "];
}

And use that as the value transformer for your new binding.  If you 
post a sample project, I'll happily mod it so you can see.

Mike.

On 4 Apr 2007, at 13:23, Shamyl Zakariya wrote:

> Since nobody's helping me out, perhaps I'm describing the problem 
> poorly. I've put together an image describing the behavior I'm 
> seeing and hopefully somebody will lend me a hand.
>
> http://zakariya.net/shamyl/Bindings/ValueTest/BindingTrouble0.png
>
> <email_removed>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%
> 40mikeabdullah.net
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlBindings + contents of an array. No dice, for newb. Shamyl Zakariya Apr 3, 23:47
mlRe: Bindings + contents of an array. No dice, for newb. Shamyl Zakariya Apr 4, 14:23
mlRe: Bindings + contents of an array. No dice, for newb. Mike Abdullah Apr 4, 16:21
mlRe: Bindings + contents of an array. No dice, for newb. Shamyl Zakariya Apr 4, 19:26