I need to test whether the object is of type NSString
or UIImageView
. How can I accomplish this? Is there some type of "isoftype" method?
转载于:https://stackoverflow.com/questions/1144629/in-objective-c-how-do-i-test-the-object-type
I need to test whether the object is of type NSString
or UIImageView
. How can I accomplish this? Is there some type of "isoftype" method?
转载于:https://stackoverflow.com/questions/1144629/in-objective-c-how-do-i-test-the-object-type
If your object is myObject
, and you want to test to see if it is an NSString
, the code would be:
[myObject isKindOfClass:[NSString class]]
Likewise, if you wanted to test myObject
for a UIImageView
:
[myObject isKindOfClass:[UIImageView class]]