Jump to content

How to get object type


2 posts in this topic

Recommended Posts

id object = [NSMutableString new];

 

// TRUE:

if([[object class] isKindOfClass:[NSString class]]) NSLog(@"True");

 

// FALSE

if([[object class] isMemberOfClass:[NSString class]]) NSLog(@"False");

 

See this: http://developer.apple.com/documentation/C...3-CH11-BAJCDADF

 

You can also get the className string for Class object using an Obj-C runtime function:

 

const char *className = class_getName(Class);

Link to comment
Share on other sites

 Share

×
×
  • Create New...