Last active
May 25, 2022 02:36
-
-
Save Glideh/325efa9b5f3a062b0065 to your computer and use it in GitHub Desktop.
Lists views recursively with indentation for subviews
This file contains 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)listSubviewsOfView:(UIView *)view { | |
[self listSubviewsOfView:(UIView *)view withPrefix:@""]; | |
} | |
- (void)listSubviewsOfView:(UIView *)view withPrefix:(NSString *)prefix { | |
NSArray *subviews = [view subviews]; | |
for (UIView *subview in subviews) { | |
NSLog(@"%@ %@ (%d %d; %d %d)", prefix, subview.class | |
, (int)subview.frame.origin.x | |
, (int)subview.frame.origin.y | |
, (int)subview.frame.size.width | |
, (int)subview.frame.size.height); | |
[self listSubviewsOfView:subview withPrefix:[NSString stringWithFormat:@"%@ ", prefix]]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example of output: