Re: Tell which type is in NSValue?
Re: Tell which type is in NSValue?
- Subject: Re: Tell which type is in NSValue?
- From: aaron smith <email@hidden>
- Date: Wed, 5 Aug 2009 18:59:39 -0700
Thanks for the info. Yeah I have a method right now that accepts
NSValue, and I'm figuring out what is in the value. But I'm going to
add methods that explicitly require NSPoint, etc. Thanks again for the
help, much appreciated. -A
On Wed, Aug 5, 2009 at 4:13 AM, Graham Cox<email@hidden> wrote:
>
> On 05/08/2009, at 6:27 PM, Alastair Houghton wrote:
>
>> Usually when you're using NSValue, you already know what type you're
>> dealing with. If you have a situation where you need to distinguish between
>> several different things, you might be better off making some wrapper
>> classes (or maybe subclasses of NSValue, which is how NSNumber works).
>
>
> Not only that, but note this from the docs for [NSNumber objCType]: "Special
> Considerations The returned type does not necessarily match the method the
> receiver was created with."
>
> This makes it very hard to preserve type information using NSNumbers -
> integers and floats usually end up converted internally to doubles, I found.
> The same warning does not appear to be applied to NSValue however. If type
> is of critical importance though, I'd store it explicitly in an object of
> your own devising.
>
> --Graham
>
>
>
_______________________________________________
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