iphone - Testing for the class type -
When I send an object NSLog, I get a string with three attributes. The first thing is the square of the object, the other is the frame of the object, and the third item is a claire. The title of the second and third attributes (such as layer =), so I can call them by the title (like myObject.layer).
Not the first. How do I test for class type?
Thank you! Class of an object to get [myObject class]
If ([myObject class] == [some class squares]) {/ * ... * /} If ([myObject class] == [NSString class]) {/ * ... * /}
If you are looking for the name of the class only as a string, then you NSStringFromClass The
function can be used as follows:
NSString * className = NSStringFromClass ([myObject class]);
Comments
Post a Comment