2014-07-11 194 views
-5

我有以下警告使用代码中的iOS 7.0会显示使用sizeWithAttribute:这里是下面的代码,我已经使用:sizeWithFont IOS 7.0弃用

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

如果任何人有意见怎么上述去除代码sizeWithAttribute:所以请告诉我。先谢谢了。

+2

尝试张贴问题之前,做一些搜索。 –

回答

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

希望它可以帮助...

+0

thnx男人它会为我工作 – alfa

+0

我很高兴帮助你.. – Iphonenew

0

使用sizeWithAttributes:相反,它现在需要一个NSDictionary。通过在对与关键UITextAttributeFont和您的字体对象是这样的:

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

感谢

相关问题