isKindOfClass:和isMemberOfClass:-b

Posted qigemingnan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

以上是关于isKindOfClass:和isMemberOfClass:-b的主要内容,如果未能解决你的问题,请参考以下文章

isKindOfClass和isMemberOfClass

isKindOfClass和isMemberOfClass 的区别

iOS isKindOfClass 和 isMemberOfClass 的区别

奇怪的`isKindOfClass`行为

isKindOfClass VS isMemberOfClass

isKindOfClass 抓取标签