计算字符串高度

- (float)countHeightOfString:(NSString *)string WithWidth:(float)width Font:(UIFont *)font {
	if ([NSNull null] == (id)string) {
		string = @"暂时没有数据";
	}
	CGSize constraintSize = CGSizeMake(width,500);//MAXFLOAT
	CGSize labelSize = [string sizeWithFont:font constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap];
    
	return labelSize.height+10;
}

你可能感兴趣的:(字符串)