//遍历所有的子控件,并打印其Frame
+(NSString )searchAllSubviews:(UIView )superview
{
NSMutableString xml = [NSMutableString];
NSString class = NSStringFromClass( superview.class );
class = [class stringByReplacingOccurrencesOfString: @"_" withString: @""];
[xml appendFormat:@"<%@ frame = "%@">\n" , class, NSStringFromCGRect( superview.frame)];
for (UIView child in super.subviews){
NSString subViewXml = [self searchAllSubviews : childView];
[xml appendString : subviewXml];
}
[xml appendFormat :@"<\%@>\n",class];
return xml;
}
block外的变量不能在block中修改
若想改变则应在变量前加上__block