计算字符串高度

- (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;
}

猜你喜欢

转载自longquan.iteye.com/blog/1844966