Skip to content

Instantly share code, notes, and snippets.

@naiveal
Created July 27, 2012 09:48
Show Gist options
  • Save naiveal/3187150 to your computer and use it in GitHub Desktop.
Save naiveal/3187150 to your computer and use it in GitHub Desktop.
printfTreeLevelOfView
void printfTreeLevelOfView(UIView *view, int maxLevel)
{
UIView *tempView;
NSArray *subViews = [view subviews];
static int level = 0;
level++;
for(tempView in subViews)
{
if ( level <= maxLevel) {
for (int i = 0; i < level; i++)
{
printf("| ");
}
printf("____");
NSLog(@"Level :%d, %@",level, tempView);
if ([[tempView subviews] count] > 0) {
printfTreeLevelOfView(tempView, maxLevel);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment