Created
July 27, 2012 09:48
-
-
Save naiveal/3187150 to your computer and use it in GitHub Desktop.
printfTreeLevelOfView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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