美文网首页
辨析isKindOfClass、isSubclassOfClas

辨析isKindOfClass、isSubclassOfClas

作者: Coder_JMicheal | 来源:发表于2018-05-29 15:32 被阅读10次

    一、苹果官方API的解释是:

    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.

    isMemberOfClass:Returns a Boolean value that indicates whether the receiver is an instance of a given class.

    isSubclassOfClass:Returns a Boolean value that indicates whether the receiving class is a subclass of, or identical to, a given class.

    二、它们的作用的区别:

    isKindOfClass:判断对象是否为某类或者其派生类的实例(对象方法);

    isSubclassOfClass:判断对象是否为某类或者其派生类的实例(类方法);

    isMemberOfClass:判断对象是否为某个特定类的实例(对象方法);

    相关文章

      网友评论

          本文标题:辨析isKindOfClass、isSubclassOfClas

          本文链接:https://www.haomeiwen.com/subject/zllajftx.html