• 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: Tell which type is in NSValue?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Tell which type is in NSValue? (From: aaron smith <email@hidden>)
 >Re: Tell which type is in NSValue? (From: Bill Bumgarner <email@hidden>)
 >Re: Tell which type is in NSValue? (From: aaron smith <email@hidden>)
 >Re: Tell which type is in NSValue? (From: Alastair Houghton <email@hidden>)
 >Re: Tell which type is in NSValue? (From: Graham Cox <email@hidden>)

  • Prev by Date: Disabling Exposé in SystemUIMode
  • Next by Date: Setting the width of a segment to 0 in NSSegmentedControl doesn't work so well
  • Previous by thread: Re: Tell which type is in NSValue?
  • Next by thread: Generating random numbers
  • Index(es):
    • Date
    • Thread