开发者

Finding out if a class is a subclass of another class (Objective-C)

So I have a Class object, say for class 'D'. Is there a way to figure out if that class object is a subclass of another Class object, say 'B'? I tried -isKindOf开发者_Python百科Class: and isMemberOfClass, but neither worked. Thanks!


You should use class method +isSubclassOfClass.


Well hello there Grimless!

-isKindOfClass: should work fine, it says so in the documentation: http://developer.apple.com/library/mac/#/library/ios/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html

But there is another class method in NSObject called +isSubclassOfClass: that you should use instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜