美文网首页
#import "UIView+Log.h"

#import "UIView+Log.h"

作者: 26b5cc676194 | 来源:发表于2016-01-19 13:25 被阅读17次

#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"

      本文链接:https://www.haomeiwen.com/subject/mtnkkttx.html