Refine cell sizing.
This commit is contained in:
parent
7be6fbc24f
commit
c6f370810b
@ -1026,7 +1026,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
}
|
||||
|
||||
CGFloat hMargins = self.conversationStyle.textInsetHorizontal * 2;
|
||||
|
||||
const int maxTextWidth = (int)floor(self.conversationStyle.maxMessageWidth - hMargins);
|
||||
|
||||
[self configureBodyTextView];
|
||||
@ -1042,6 +1041,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
OWSAssert(self.conversationStyle.maxMessageWidth > 0);
|
||||
|
||||
CGFloat maxMessageWidth = self.conversationStyle.maxMessageWidth;
|
||||
if (!self.hasFullWidthMediaView) {
|
||||
CGFloat hMargins = self.conversationStyle.textInsetHorizontal * 2;
|
||||
maxMessageWidth -= hMargins;
|
||||
}
|
||||
|
||||
CGSize result = CGSizeZero;
|
||||
switch (self.cellType) {
|
||||
@ -1150,7 +1153,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
const int maxTextWidth = (int)floor(self.conversationStyle.maxMessageWidth - hMargins);
|
||||
[self configureSenderNameLabel];
|
||||
CGSize result = CGSizeCeil([self.senderNameLabel sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)]);
|
||||
|
||||
result.width = MIN(result.width, maxTextWidth);
|
||||
return [NSValue valueWithCGSize:result];
|
||||
}
|
||||
|
||||
@ -1230,6 +1233,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
cellSize = CGSizeCeil(cellSize);
|
||||
|
||||
OWSAssert(cellSize.width <= self.conversationStyle.maxMessageWidth);
|
||||
cellSize.width = MIN(cellSize.width, self.conversationStyle.maxMessageWidth);
|
||||
|
||||
return cellSize;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user