文字高度问题

1: UILabel

加 NSMutableAttributedString

用下面的方法计算高度.

    contentSize = [dstAttrStr boundingRectWithSize:CGSizeMake(_contentLabel.frame.size.width, 100000)

                                               options:NSStringDrawingUsesLineFragmentOrigin

                                               context:nil].size;

 

 

2: TTTAttributedLabel

加 NSMutableAttributedString

用TTT的方法

 CGSize contentSize = [TTTAttributedLabel sizeThatFitsAttributedString:dstAttrStr

                                                              withConstraints:CGSizeMake(_contentLabel.frame.size.width, 100000)

                                                       limitedToNumberOfLines:0];

posted @ 2015-12-15 10:47  willbin  阅读(308)  评论(0编辑  收藏  举报