Monday, July 30, 2012

iOS view hierarchy

Sometimes it is usefeul to find the view hierarchy of a certain graphical component.
On iOS, here's a small code snippet to do this:


- (void) printViews:(UIView *)cell marker:(NSString *)s{
for(UIView *v in cell.subviews){
NSString *s2 = [s stringByAppendingString:@"*"];
NSLog(@"%@ %@", s2, v);
[self printViews:v marker:s2];
}
}

No comments:

Post a Comment