DEPRECATED方法 修改

使用中经常会遇到,特意总结一下:

原方法名 功能 摒弃版本 推荐方法 使用方式
sizeWithFont 根据字体大小获取size iOS7.0 sizeWithAttributes

参数Dictionary

key:参考NSAttributeString.h

例子

NSMutableParagraphStyle* paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];

paragraphStyle.lineBreakMode = NSLineBreakByClipping;

paragraphStyle.alignment     = textAlignment;

CGSize title1Size = [text sizeWithAttributes:@{NSFontAttributeName : font

,NSParagraphStyleAttributeName:paragraphStyle

}];

持续更新中    

    

原文地址:https://www.cnblogs.com/zhangrunchao/p/6008014.html