2

我有带有 NSString 文本的 CCLabelTTF。5 日 IOS sizeWithFont: 返回高度大于 sizeWithAttributes: 7 日。

if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] == NSOrderedAscending)
{
     dim = [string sizeWithFont:font];
}
else
{
     dim = [string sizeWithAttributes:[NSDictionary dictionaryWithObject:[UIFont fontWithName:name size:(CGFloat)size] forKey:NSFontAttributeName]];
}

dim differs on 1 pixel for 5 and 7 ios
4

0 回答 0