Is the a way to get the number of ancestors for an instance of class? E.g. a class of type UITouch would be of level 2 as it inherits from NSObject.
+5
A:
int level = 1;
Class cls = [UITouch class];
while (cls = [cls superclass])
++ level;
return level;
KennyTM
2010-04-14 13:38:52