IOS开发札记

//遍历所有的子控件,并打印其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

上一篇:iOS开发如何面对疫情过后的面试高峰期 !


下一篇:用Java实现网络爬虫