sKindOfClass和isMemberOfClass之间的区

sKindOfClass和isMemberOfClass之间的区

本文介绍了iPhone SDK isKindOfClass和isMemberOfClass之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我 isKindOfClass:(Class)aClass isMemberOfClass:(Class)aClass 函数?
我知道它是一个小的东西,一个是全局的,而另一个是一个确切的类匹配,但我需要有人指定哪个是。

Can any one tell me what the difference is between the isKindOfClass:(Class)aClass and the isMemberOfClass:(Class)aClass functions?I know it is something small like, one is global while the other is an exact class match but I need someone to specify which is which please.

推荐答案

isMemberOfClass:如果接收者是指定类的实例,则返回YES。

isMemberOfClass: returns YES if the receiver is an instance of the specified class.

大多数时候,你想使用 isKindOfClass:来确保你的代码也能用于子类。

Most of the time you want to use isKindOfClass: to ensure that your code also works with subclasses.

更多地谈到这些方法。

The NSObject Protocol Reference talks a little more about these methods.

这篇关于iPhone SDK isKindOfClass和isMemberOfClass之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 05:10