-(BOOL) isKindOfClass: classObj
判断是否是这个类,包括这个类的子类和父类的实例;
<code>
-(BOOL)isKindOfClass:(Class)cls {
for (Class tcls = [self class]; tcls; tcls = tcls->superclass) {
if (tcls == cls) return YES;
}
return NO;
}
</code>
isMemberOfClass
-(BOOL) isMemberOfClass: classObj 判断是否是这个类的实例,不包括子类或者父类;
<code>
-(BOOL)isMemberOfClass:(Class)cls {
return [self class] == cls;
}
</code>