Reputation: 14571
Suppose I have the object *x
of class Illustration
. Using x
, I'd like to extract its class name into a string so I have @"Illustration"
. Is it possible to do this?
Upvotes: 0
Views: 1168
Reputation: 1154
Use NSStringFromClass.
NSString* className = NSStringFromClass([x class]);
NSString* className = [[x class] description];
Upvotes: 5