UIFont *fontOne = [UIFont
systemFontOfSize:15.0];//设置字体大小
NSString *productDetailsString =[[[[[NSString
stringWithFormat:@"%@",[resultDic
objectForKey:@"productDetails"]]
stringByReplacingOccurrencesOfString:@" "
withString:@""]
stringByReplacingOccurrencesOfString:@"“"
withString:@""]stringByReplacingOccurrencesOfString:@"”"
withString:@""]
stringByReplacingOccurrencesOfString:@"‘"
withString:@""] ;//要显示的内容
CGSize maximumLabelSizeOne =
CGSizeMake(300,MAXFLOAT);
CGSize labelSize=[productDetailsString
sizeWithFont:fontOne constrainedToSize:maximumLabelSizeOne
lineBreakMode:UILineBreakModeWordWrap];
if(500+ labelSize.height*labelSize.width/300>1260)
{
scrollview.contentSize =
CGSizeMake(0,600+ labelSize.height*labelSize.width/300);
}else{
scrollview.contentSize =
CGSizeMake(0,500+ labelSize.height*labelSize.width/300);
}
//初始化UILabel
CGRect pointValueRect =
CGRectMake(10, 380 ,300, labelSize.height*labelSize.width/300);
NSLog(@"%f", labelSize.height*labelSize.width/300/30);
detailContent.frame=pointValueRect;
detailContent.lineBreakMode =
UILineBreakModeWordWrap;
detailContent.numberOfLines = 0;//上面两行设置多行显示
detailContent.text=productDetailsString;
detailContent.sizeToFit;