逆钟夕的忘忧阁

有朋自远方来,不亦乐乎?

sizeWithFont:constrainedToSize:转boundingRectWithSize:options

CGFloat width1=[(NSString *)ob1 sizeWithFont:[UIFont systemFontOfSize:16] constrainedToSize:CGSizeMake(1000, FONTHEIGHT)].width;

CGFloat width1=[(NSString *)ob1 boundingRectWithSize:CGSizeMake(1000, FONTHEIGHT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size.width;

boundingRectWithSize: CGSize 对应 constrainedToSize: CGSize
attributes:@{NSFontAttributeName: [ UIFont ] } 对应 sizeWithFont[ UIFont ]
options: NSStringDrawingUsesLineFragmentOrigin 默认照填

context: nil 默认照填




阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/pengyuan_D/article/details/49905503
个人分类: 经典错误
上一篇Local declaration of 'XXX' hides instance variable
下一篇setFont for UIButton is deprecated
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭