我正在使用此代码导致不同版本的 ios 的值不同。
CGSize textSize = [title sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0f]}];
我试过你的代码:
NSString* title = @"Hey nonny nonny we like to party";
CGSize textSize = [title sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0f]}];
NSLog(@"%@", NSStringFromCGSize(textSize));
我得到了这些结果。IOS 7:
2015-05-22 07:50:22.266 Test[1153:607] {214.49399999999994, 16.701999999999998}
iOS 8:
2015-05-22 07:49:57.957 Test[1090:31606] {214.49399999999994, 16.701999999999998}
在我看来是一样的。我不得不猜测您的测试程序有问题。