是否有可能追踪班级的超级课程,直到最后使用NSObject?
我在这里有一些伪代码,但它需要一些实现。
SomeObject *someObj;
id *currentParent = someObj.Parent;
while (currentParent)
{
NSLog(@"%@",currentParent);
currentParent = currentParent.Parent;
}
答案 0 :(得分:2)
SomeObject *someObj;
id currentParent = [someObj superclass];
while (currentParent)
{
NSLog(@"%@",currentParent);
currentParent = [currentParent superclass];
}