试试这个简单的代码
UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
label.backgroundColor=[UIColor clearColor];
label.text= yourString;
label.numberOfLines=0;
label.adjustsFontSizeToFitWidth=YES;
label.minimumFontSize=6;
label.textAlignment=UITextAlignmentCenter;
[self.View addSubview:label];
CGFloat fontSize = 20;
while (fontSize > 0.0)
{
CGSize size = [yourString sizeWithFont:[UIFont fontWithName:@"Rockwell-Bold" size:fontSize] constrainedToSize:CGSizeMake(label.frame.size.width, 10000) lineBreakMode:UILineBreakModeWordWrap];
if (size.height <= label.frame.size.height) break;
fontSize -= 1.0;
}
//set font size
label.font = [UIFont fontWithName:@"Rockwell-Bold" size:fontSize];
[label release];