I have a non-editable UITextView object inside a UITableViewCell with appropriate constraints. It is loaded as follows:
.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];
}
The cell and the UITextView resize fine (height only), but there are more lines of (blank) text dynamically added to the UITextView than needed at the bottom.
Can anyone help please?