//新建字符串
NSString *text =@"這個是測試數(shù)據(jù)";
//計算文本文字size
CGSize size = [text sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:18.0f]}];
//獲取寬高
CGSize statuseStrSize = CGSizeMake(ceilf(size.width), ceilf(size.height));
//打印寬高
NSLog(@"%@_width:%f_height:%f",NSStringFromCGSize(statuseStrSize),size.width,size.height);