• 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 01:26:20 -0700

ah. I got it. Here's what I did. this seems like the slickets or
standard way to go:

NSPoint thePoint2 = NSMakePoint(30.0,35.0);
NSValue *test = [NSValue valueWithBytes:&thePoint2 objCType:@encode(NSPoint)];
if(strcmp((const char *)[test objCType],(const char *)@encode(NSPoint))==0) {
}

On Wed, Aug 5, 2009 at 1:15 AM, aaron
smith<email@hidden> wrote:
> thanks for the info. I'm trying to put it all together. help me out?
>
> I've tried a couple diff things, here's what Im trying..
>
> NSPoint thePoint2 = NSMakePoint(30.0,35.0);
> //NSValue *test = [NSValue valueWithBytes:&thePoint2 objCType:@encode(NSPoint)];
> NSValue *test = [NSValue valueWithPoint:thePoint2];
> if([test objCType] == @encode(NSPoint)) printf("test is an NSPoint");
>
> thanks a bunch
>
>
>
>
> On Tue, Aug 4, 2009 at 11:59 PM, Bill Bumgarner<email@hidden> wrote:
>> On Aug 4, 2009, at 11:38 PM, aaron smith wrote:
>>
>>> if I receive an NSValue object, how can I find out if the value it
>>> contains is a point/rect/size/ etc. I can't figure out what to compare
>>> it with, and can't figure out if the objCType is something I can use
>>> for that problem. Any ideas?
>>
>> This:
>>
>> http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/nsvalue_Class/Reference/Reference.html#//apple_ref/occ/instm/NSValue/objCType
>>
>> Implies this:
>>
>> http://developer.apple.com/documentation/Cocoa/Conceptual/NumbersandValues/Articles/Values.html#//apple_ref/doc/uid/20000174-BAJJHDEG
>>
>> Which implies this:
>>
>> http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html
>>
>> b.bum
>>
>>
>>
>>
>
_______________________________________________

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>)

  • Prev by Date: Re: Tell which type is in NSValue?
  • Next by Date: Re: Tell which type is in NSValue?
  • Previous by thread: Re: Tell which type is in NSValue?
  • Next by thread: Re: Tell which type is in NSValue?
  • Index(es):
    • Date
    • Thread