On Jul 29, 2009, at 19:58, Graham Cox wrote:

I'm not sure I've fully followed your question, since I'm not as up with bindings as you are, but I'm just wondering: have you overlooked the fact that @"self" is a valid keypath or keypath component? If the array holds strings and you are binding to the string itself, its value is "self".

I hope I haven't misunderstood...

You're correct as far as getting the strings is concerned, but unfortunately "self" won't work for changing the string value, which the OP also asked for.

Weirdly, NSMutableString has a "setString:" instance method, so I think if you add a "string" instance method to NSString (via a category, with the method just returning self), you end up with a valid "string" property which can be bound to. :)

I *think* I actually tried that once and it worked.

But it's more of a curiosity than anything else:

1. It's likely in the OP's case that actually changing one of the strings ought to ripple through to all the objects that have a matching string value. It's unlikely that just changing the defaults- resident string is enough.

2. It's almost as easy to wrap a string in an object with a string property.

Putting those 2 reasons together, I think about 5 minutes after getting the string-binding thing working you'd end up using a smarter object anyway.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to