Discover subclasses of a given class in Obj-C

后端 未结 5 1295
北海茫月
北海茫月 2020-12-16 21:15

Is there any way to discover at runtime which subclasses exist of a given class?

Edit: From the answers so far I think I need to clarify a bit more

5条回答
  •  没有蜡笔的小新
    2020-12-16 21:31

    Marc and bbum hit it on the money. This is usually not a good idea.

    However, we have code on our CocoaHeads wiki that does this: http://cocoaheads.byu.edu/wiki/getting-all-subclasses

提交回复
热议问题