码迷,mamicode.com
首页 > 移动开发 > 详细

'sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:

时间:2015-02-22 11:00:56      阅读:293      评论:0      收藏:0      [点我收藏+]

标签:

解决方法:
 
NSString *myText = @"xxxxx";
CGSize mySize =[myText sizeWithFont:myFont constrainedToSize:CGSizeMake(200,100)];
 
改写成:

CGSize mySize = [myText boundingRectWithSize:CGSizeMake(200,100) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:myFont} context:nil].size;

'sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:

标签:

原文地址:http://www.cnblogs.com/tonyxu/p/4297337.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!