在使用過程當中碰到了 isKindOfClass 和 isMemberOfClass 這兩個類,有點好奇。因而search了一下。因而有了下屬結論。 html
isKindOfClass: returns YES if the receiver is an instance of the specified class or an instance of any class that inherits from the specified class. app
isMemberOfClass: returns YES if the receiver is an instance of the specified class. code
Most of the time you want to use isKindOfClass: to ensure that your code also works with subclasses. htm
The NSObject Protocol Reference talks a little more about these methods. ci