我在UITableViewCell中有一个具有适当约束的不可编辑的UITextView对象。它加载如下:
·H:
@property (weak, nonatomic) IBOutlet UITextView *textContentText;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *textContentTextHeight;
的.m:
-(void)configureForTextBlock:(LessonBlock *)block {
self.textContentText.text = block.sectionContent;
self.textContentText.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
CGSize sizeThatFitsTextView = [self.textContentText sizeThatFits:self.textContentText.frame.size];
self.textContentTextHeight.constant = sizeThatFitsTextView.height;
[self.textContentText layoutIfNeeded];
[self.textContentText updateConstraints];
}
单元格和UITextView调整大小(仅限高度),但是动态添加到UITextView的(空白)文本行多于底部所需的行。
有人可以帮忙吗?