Re: Bindings + contents of an array. No dice, for newb.
Re: Bindings + contents of an array. No dice, for newb.
- Subject: Re: Bindings + contents of an array. No dice, for newb.
- From: Mike Abdullah <email@hidden>
- Date: Wed, 4 Apr 2007 15:21:59 +0100
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@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40mikeabdullah.net
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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