【发布时间】:2013-09-25 01:07:38
【问题描述】:
在iOS 7中,方法:
- (CGSize)sizeWithFont:(UIFont *)font
constrainedToSize:(CGSize)size
lineBreakMode:(NSLineBreakMode)lineBreakMode
以及方法:
- (CGSize)sizeWithFont:(UIFont *)font
已弃用。我该如何替换
CGSize size = [string sizeWithFont:font
constrainedToSize:constrainSize
lineBreakMode:NSLineBreakByWordWrapping];
和:
CGSize size = [string sizeWithFont:font];
【问题讨论】:
-
替代方法是
-sizeWithAttributes:。 -
okholex 谢谢,但是,我怎样才能使用像 NSDIctionary 这样的标签字体?如果我的代码是这样的: sizeWithFont:customlabel.font ;空问 "sizeWithAttributes:"
标签: ios iphone ios7 nsstring sizewithfont