我有以下警告要在 iOS 7.0 中使用代码,它将显示sizeWithAttribute:
此处使用的是我使用过的以下代码:
messageSize = [theMessage sizeWithFont:[UIFont systemFontOfSize:20.0]];
如果有人建议如何删除上述代码,sizeWithAttribute:
请告诉我。
我有以下警告要在 iOS 7.0 中使用代码,它将显示sizeWithAttribute:
此处使用的是我使用过的以下代码:
messageSize = [theMessage sizeWithFont:[UIFont systemFontOfSize:20.0]];
如果有人建议如何删除上述代码,sizeWithAttribute:
请告诉我。
改用 sizeWithAttributes:,它现在需要一个 NSDictionary。使用键 UITextAttributeFont 和您的字体对象传递对,如下所示:
CGSize size = [string sizeWithAttributes:
@{NSFontAttributeName:
[UIFont systemFontOfSize:20.0f]}];
谢谢
CGSize size = [theMessage sizeWithAttributes:
@{NSFontAttributeName:
[UIFont systemFontOfSize:20.0f]}];
希望能帮助到你...