为什么sizeWithFont:和sizeWithAttributes:返回不同的值?

时间:2013-10-07 11:37:38

标签: xcode cocos2d-iphone ios7 cclabelttf

我有CCLabelTTF和NSString文本。在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

0 个答案:

没有答案