-5

我有以下警告要在 iOS 7.0 中使用代码,它将显示sizeWithAttribute:此处使用的是我使用过的以下代码:

messageSize = [theMessage sizeWithFont:[UIFont systemFontOfSize:20.0]];

如果有人建议如何删除上述代码,sizeWithAttribute:请告诉我。

4

2 回答 2

0

改用 sizeWithAttributes:,它现在需要一个 NSDictionary。使用键 UITextAttributeFont 和您的字体对象传递对,如下所示:

CGSize size = [string sizeWithAttributes:
                       @{NSFontAttributeName:
                         [UIFont systemFontOfSize:20.0f]}];

谢谢

于 2014-07-11T05:49:06.173 回答
0
CGSize size = [theMessage sizeWithAttributes:
                       @{NSFontAttributeName:
                         [UIFont systemFontOfSize:20.0f]}];

希望能帮助到你...

于 2014-07-11T05:50:53.063 回答