sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithS
来源:互联网 发布:淘宝客服语言欢迎语 编辑:程序博客网 时间:2024/05/25 13:33
文章来自:http://www.aichengxu.com/view/41622
/*之前使用了NSString类的sizeWithFont:constrainedToSize:lineBreakMode:方法,但是该方法已经被iOS7 Deprecated了,而iOS7新出了一个boudingRectWithSize:options:attributes:context方法来代替。
而具体怎么使用呢,尤其那个attribute(属性)
NSDictionary *attribute = @{NSFontAttributeName: [UIFont systemFontOfSize:13]}; CGSize stringSize = [string boundingRectWithSize:CGSizeMake(200, 300) options:NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:attribute context:nil].size;
typedef NS_ENUM(NSInteger, NSLineBreakMode) { /* What to do with long lines */
NSLineBreakByWordWrapping = 0,/* Wrap at word boundaries, default */
以单词为单位换行,以单位为单位截断。
NSLineBreakByCharWrapping, /* Wrap at character boundaries */
以字符为单位换行,以字符为单位截断。
NSLineBreakByClipping,/* Simply clip */
以单词为单位换行。以字符为单位截断。
NSLineBreakByTruncatingHead, /* Truncate at head of line: "...wxyz" */
以单词为单位换行。如果是单行,则开始部分有省略号。如果是多行,则中间有省略号,省略号后面有4个字符。
0 0
- sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithS
- 'sizeWithFont:' is deprecated: first deprecated in iOS 7.0 - Use -sizeWithAttributes:
- cString is deprecated :first deprecated in iOS 2.0
- "dismissModalViewControllerAnimated" is deprecated : first deprecated in iOS 6.0
- [问题记录]cString is deprecated :first deprecated in iOS 2.0
- [问题记录]'dismissModalViewControllerAnimated:' is deprecated: first deprecated in iOS 6.0
- UITextAlignmentCenter' is deprecated: first deprecated in iOS 6.0 UITextAlignmentCenter
- 'minimumFontSize' is deprecated: first deprecated in iOS 6.0
- Replacement for deprecated sizeWithFont: in iOS 7?
- 'UITextAlignmentRight' is deprecated: first deprecated in ios6.0
- ABAddressBookCreate is deprecated: first deprecated in IOS6.0
- 解决interfaceOrientation is deprecated:first deprecated in ios8.0
- IOS7.0 sizeWithFont:constrainedToSize:lineBreakMode:方法 iOS7 Deprecated
- IOS7.0 sizeWithFont:constrainedToSize:lineBreakMode:方法 iOS7 Deprecated
- 'dispath_get_current_queue'is deprecated:fist deprecated in iOS 6.0的解决办法
- UIAlertView is deprecated in iOS 8.
- Deprecated: Function ereg() is deprecated in
- Deprecated: Function ereg() is deprecated in
- java的一些小程序例子--3
- 学习网站列表
- oracle字符串转日期格式
- kali linux iso 用 win32imager 写入,才能引导
- Oracle trunc()函数的用法
- sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithS
- Google Guava常用类库
- 数据问题导致程序报错
- BZOJ 2160 拉拉队排练 Manacher + 前缀和
- [leetCode 118 & 119]Pascal's Triangle I && II (杨辉三角问题)
- Hadoop Shell命令
- 排序算法
- 【驱动开发】file_operations ---linux 2.6.30
- 关于Xcode中plise得使用