isKindOfClass:和isMemberOfClass:-b

isKindOfClass:

Returns a Boolean value that indicates whether the receiver is an instance of given class or an instance of any class that inherits from that class. (required)

isKindOfClass能确定一个对象是否是一个类的成员,或者是派生自该类的成员

 

 

isMemberOfClass:

Returns a Boolean value that indicates whether the receiver is an instance of a given class. (required)

isMemberOfClass只能确定一个对象是否是一个类的成员

 

例如:

[[NSMutableData data] isKindOfClass:[NSData class]];      // YES

[[NSMutableData data] isMemberOfClass:[NSData class]]; // NO

posted on 2016-06-16 17:15  🌞Bob  阅读(169)  评论(0编辑  收藏  举报

导航