Room Settings: Fix rendering of the room topic.

This commit is contained in:
giomfo
2016-07-01 15:50:37 +02:00
parent ab563b96a8
commit 55ecbfd527
4 changed files with 99 additions and 19 deletions
@@ -18,18 +18,55 @@
@implementation TableViewCellWithLabelAndLargeTextView
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- (void)awakeFromNib
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
}
[super awakeFromNib];
return self;
// Adjust text view
// Remove the container inset: this operation impacts only the vertical margin.
// Reset textContainer.lineFragmentPadding to remove horizontal margin.
_textView.textContainerInset = UIEdgeInsetsZero;
_textView.textContainer.lineFragmentPadding = 0;
}
- (void)dealloc
- (void)layoutSubviews
{
[super layoutSubviews];
CGFloat cellWidth = self.contentView.frame.size.width;
CGRect frame = _label.frame;
CGFloat minTextViewPosX = frame.origin.x + frame.size.width + _labelTrailingMinConstraint.constant;
CGFloat maxTextViewWidth = cellWidth - minTextViewPosX - _textViewTrailingConstraint.constant;
if (_textView.isFirstResponder)
{
// Use the full available width when the field is edited
_textViewWidthConstraint.constant = maxTextViewWidth;
}
else
{
// Adjust the text view width to display it on the right side of the cell
CGSize size = _textView.frame.size;
size.width = maxTextViewWidth;
size = [_textView sizeThatFits:size];
_textViewWidthConstraint.constant = size.width;
}
}
#pragma mark -
- (void)textViewDidBeginEditing:(UITextView *)textView;
{
[self setNeedsLayout];
}
- (void)textViewDidEndEditing:(UITextView *)textView
{
[self setNeedsLayout];
}
@end