CR: proper width calculation for header view

This commit is contained in:
Michael Kirk 2018-07-16 10:17:50 -06:00
parent f33e5c019c
commit 24060c17d0
2 changed files with 11 additions and 9 deletions

View file

@ -170,7 +170,7 @@ const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 23;
CGFloat strokeThickness = [self strokeThicknessWithViewItem:viewItem];
result.height += strokeThickness;
CGFloat maxTextWidth = conversationStyle.fullWidthContentWidth;
CGFloat maxTextWidth = conversationStyle.headerViewContentWidth;
CGSize titleSize = [self.titleLabel sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)];
result.height += titleSize.height + self.stackView.spacing;

View file

@ -34,11 +34,17 @@ public class ConversationStyle: NSObject {
@objc public var errorGutterTrailing: CGFloat = 0
// viewWidth - (gutterLeading + gutterTrailing)
@objc public var contentWidth: CGFloat = 0
@objc public var contentWidth: CGFloat {
return viewWidth - (gutterLeading + gutterTrailing)
}
// viewWidth - (gutterfullWidthGutterLeadingLeading + fullWidthGutterTrailing)
@objc public var fullWidthContentWidth: CGFloat = 0
@objc public var fullWidthContentWidth: CGFloat {
return viewWidth - (fullWidthGutterLeading + fullWidthGutterTrailing)
}
@objc public var headerViewContentWidth: CGFloat {
return viewWidth - (headerGutterLeading + headerGutterTrailing)
}
@objc public var maxMessageWidth: CGFloat = 0
@ -97,10 +103,6 @@ public class ConversationStyle: NSObject {
headerGutterTrailing = 28
errorGutterTrailing = 16
contentWidth = viewWidth - (gutterLeading + gutterTrailing)
fullWidthContentWidth = viewWidth - (fullWidthGutterLeading + fullWidthGutterTrailing)
maxMessageWidth = floor(contentWidth - 32)
let messageTextFont = UIFont.ows_dynamicTypeBody