#import "UIView+Log.h"

2016-01-19  本文已影响17人  26b5cc676194

#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

上一篇下一篇

猜你喜欢

热点阅读