Re: KVC and Core Foundation types
Re: KVC and Core Foundation types
- Subject: Re: KVC and Core Foundation types
- From: Roland King <email@hidden>
- Date: Fri, 01 Feb 2013 14:19:48 +0800
On 1 Feb, 2013, at 1:53 PM, Graham Cox <email@hidden> wrote:
>
> On 01/02/2013, at 4:08 PM, Kyle Sluder <email@hidden> wrote:
>
>> But CFTypes *are* NSObjects. So I'm not sure why your case isn't working. Can you be more specific?
>
>
> This is why the result surprised me - I have "known" this for years, and assumed that there wouldn't be a problem with this. But, this is the first time I've ever actually tried it, and what I found is that if I have a property, e,g
>
> @property (nonatomic, assign) CGColorRef myColor;
>
> and I ask for this using
>
> [someObject valueForKey:@"myColor"];
>
> then instead of returning the object, it hits -valueForUndefinedKey: instead.
I don't understand that. The search pattern for valueForKey: is documented very clearly and if you have a myColor method or a _myColor instance variable, as you surely must, it should find it and return it. The only question from reading the documentation is .. what should it return it as? Were that the issue, it having a problem converting a CGColorRef to something it can return, I'd not expect valueForUndefinedKey: but some other exception.
_______________________________________________
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