#import "UIView+Log.h"

#import "UIView+Log.h"

@implementation UIView (Log)

+ (NSString *)searchAllSubviews:(UIView *)superview

{

NSMutableString *xml = [NSMutableString string];

NSString *class = NSStringFromClass(superview.class);

class = [class stringByReplacingOccurrencesOfString:@"_" withString:@""];

[xml appendFormat:@"<%@ frame=\"%@\">\n", class, NSStringFromCGRect(superview.frame)];

for (UIView *childView in superview.subviews) {

NSString *subviewXml = [self searchAllSubviews:childView];

[xml appendString:subviewXml];

}

[xml appendFormat:@"\n", class];

return xml;

}

- (NSString *)description

{

return [UIView searchAllSubviews:self];

}

@end


# via@新浪微博:王星凯SoWhat

你可能感兴趣的:(#import "UIView+Log.h")