Created
September 15, 2012 21:26
-
-
Save nonopolarity/3729857 to your computer and use it in GitHub Desktop.
print out view and its subviews hierarchy
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) printSubviews:(NSView *) view withLevel:(int) level { | |
NSLog(@"%*s%@ frame: %@", level * 4, "", view, NSStringFromRect(view.frame)); | |
for (NSView *sv in [view subviews]) { | |
[self printSubviews:sv withLevel:level+1]; | |
} | |
} | |
-(void) printSubviews:(NSView *) view { | |
NSLog(@"Hierarchy:"); | |
[self printSubviews:view withLevel:0]; | |
} | |
- (void) applicationDidFinishLaunching:(NSNotification *) aNotification { | |
[self printSubviews:self.window.contentView]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment