TTTAttributedLabel 高度计算 发表于 2016-10-24 | 1.TTTAttributedLabel里的文字高度计算和普通label的动态高度不同,如果你用普通label的动态高度计算的话,在TTTAttributedLabel里则显示不对2.下面方法1234567891011// tttLabel是TTTAttributedLabel的实例// _model.content是NSString实例__block CGFloat height = 0;[self. tttLabel setText:_model.content afterInheritingLabelAttributesAndConfiguringWithBlock:^NSMutableAttributedString *(NSMutableAttributedString *mutableAttributedString) {height = [TTTAttributedLabel sizeThatFitsAttributedString:mutableAttributedStringwithConstraints:CGSizeMake(200, MAXFLOAT)limitedToNumberOfLines:0].height;return mutableAttributedString;}];NSLog(@"%f",height);