How to tell if a Class inherits from NSObject (Objective-C)

前端 未结 4 1035
小鲜肉
小鲜肉 2021-01-06 12:29

I\'m working in Objective-C on the iPhone and need to know whether a \'Class\' inherits from \'NSObject\'.

I tried checking if it responds to an NSObject selector:

4条回答
  •  孤独总比滥情好
    2021-01-06 13:14

    You can use the methods isKindOfClass: and isMemberOfClass: to determine whether a class is a subclass of another class or if it is a particular class.

提交回复
热议问题