variable indirection
variable indirection
- Subject: variable indirection
- From: Paul Phillips <email@hidden>
- Date: Sat, 22 Dec 2007 15:36:40 -0800
I am experimenting with the address book framework. I made a Person
class that acts as a wrapper around each ABPerson object. Person uses
valueForUndefinedKey to forward messages along to ABPerson's
valueForProperty. In this way I can bind to any properties (present and
future) in each person's record from a table view.
>From interface builder, this works fine if I bind to the name of the
property: e.g. "First" for first name or "Last" for last. However, the
address book framework goes to some lengths to hide those string
literals, and only advertises string constants such as
kABFirstNameProperty and of course kABLastNameProperty. So I would like
to bind to those variable names as they are presumably more stable (and
perhaps more localizable.)
My most general question is: can a variable-in-a-variable be obtained in
objective-c? Is there a better way to accomplish this, or any way that
would continue to work in the face of apple changing the string value of
those constants? Even if that's not particularly likely I'm still
interested to know what's possible here.
Thanks for any help. I only started with cocoa/objective-c about a
month ago so I hope I'm not missing anything terribly obvious.
--
Paul Phillips | Gir! Remember with your brains... you must
Everyman | behave like a human dog monster.
Empiricist | -- Zim
i pull his palp! |----------* http://www.improving.org/paulp/ *----------
_______________________________________________
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