Skip to content

Instantly share code, notes, and snippets.

@KyleLeneau
Created July 30, 2010 18:40
Show Gist options
  • Save KyleLeneau/501090 to your computer and use it in GitHub Desktop.
Save KyleLeneau/501090 to your computer and use it in GitHub Desktop.
//
// UIView+Additions.h
//
// Created by Kyle LeNeau on 7/30/10.
// Copyright 2010 KyleLeNeau.com. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UIView (Additions)
- (void)printSubviews:(UIView *)theView;
@end
//
// UIView+Additions.m
//
// Created by Kyle LeNeau on 7/30/10.
// Copyright 2010 KyleLeNeau.com. All rights reserved.
//
#import "UIView+Additions.h"
@implementation UIView (Additions)
- (void)printSubviews:(UIView *)theView {
static NSInteger depthCount = 0;
NSArray *subviewArray = [theView subviews];
NSMutableString *tabString = [NSMutableString stringWithCapacity:depthCount];
for (int i = 0; i < depthCount; i++) {
[tabString appendString:@" -- "];
}
NSLog(@"%@ %@", tabString, theView);
if (subviewArray) {
depthCount++;
for (UIView *v in subviewArray) {
[self printSubviews:v];
}
depthCount--;
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment