• 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: Binding to an array of NSStrings stored in an application's preferences
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding to an array of NSStrings stored in an application's preferences


  • Subject: Re: Binding to an array of NSStrings stored in an application's preferences
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 29 Jul 2009 20:43:55 -0700

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 (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: 
 >Binding to an array of NSStrings stored in an application's preferences (From: A B <email@hidden>)
 >Re: Binding to an array of NSStrings stored in an application's preferences (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Binding to an array of NSStrings stored in an application's preferences
  • Next by Date: Re: UIWebView: prevent from displaying menu, Copy.
  • Previous by thread: Re: Binding to an array of NSStrings stored in an application's preferences
  • Next by thread: Re: Binding to an array of NSStrings stored in an application's preferences
  • Index(es):
    • Date
    • Thread