1.masonry等分ui
mas_distributeViewsAlongAxisspa
MASAxisTypeHorizontalcode
2.uilabel sizetofitblog
+(CGSize)labSizeWithStr:(NSString *)_str font:(UIFont *)_font labWidth:(int)_labWidth lineSpacing:(int)_lineSpacing numberOfLines:(int)_numberOfLines{
if (!_str) { return CGSizeZero; } UILabel *cLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, _labWidth, 0)]; [cLabel setFont:_font]; [cLabel setNumberOfLines:_numberOfLines]; NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; [paragraphStyle setLineSpacing:_lineSpacing]; [cLabel setAttributedText:[[NSAttributedString alloc] initWithString:_str attributes:@{NSParagraphStyleAttributeName:paragraphStyle}]]; [cLabel sizeToFit]; CGSize returnSize = cLabel.size; cLabel = nil; return returnSize; }
http://blog.51cto.com/liyun2422/1732186ci