yes I just picked a totally random key name tied to the question the original poster was asking, it was supposed to be illustrative (he wanted to associate an object with the layer so I picked a name to attempt to show that).
No sorry in general it doesn't work that way, it's possible, probably not even that hard, to make a class KVC compliant in a way which allows arbitrary keys but it is not the norm. CALayer (and CAAnimation) do provide this facility, you can setValue:forKey and call valueForKey: on them for a key you define and they also provide a default function too. This is what the documentation actually says Both CALayer and CAAnimation are key-value coding compliant container classes, allowing you to set values for arbitrary keys. That is, while the key “foo” is not a declared property of theCALayer class, however you can still set a value for the key “foo” as follows: In this case my language was rather sloppy, perhaps the documentation should say .. "are key-value compliant container classes which also allow you to set values for arbitrary keys ... " On 01-Feb-2010, at 11:35 PM, Charles Jenkins wrote: > > On 2010-02-01 03:26, Roland King wrote: >> >> By the way, CALayer is a KVC compliant class so you can in fact just store a >> reference to an arbitrary object in it with >> >> [ layer setValue:value forKey:@"KeyForObjectAssociatedWithLayer" ]; > > Roland, I'm a noob and I'm not sure I've got a good handle on KVC yet... This > statement really looks interesting to me, because it seems to suggest that > with a KVC-compliant class, you can make arbitrary linkages by just making up > keys. (I checked the documentation, and haven't found any property named > objectAssociatedWithLayer, so I'm assuming that you were able to create this > key name yourself and name it whatever you liked.) Is this true or have I > totally misunderstood you? > _______________________________________________ > > 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/rols%40rols.org > > This email sent to r...@rols.org _______________________________________________ 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