label.adjustsFontSizeToFitWidth = YES;
- (void)setFontSizeThatFits:(UILabel*)label
{
CGFloat fontSizeThatFits;
[label.text sizeWithFont:label.font
minFontSize:12.0 //最小字体
actualFontSize:&fontSizeThatFits
forWidth:label.bounds.size.width
lineBreakMode:NSLineBreakByWordWrapping];
label.font = [label.font fontWithSize:fontSizeThatFits];
}
网友评论