Use reference cells for measurement.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-06-13 10:46:16 -04:00
parent 91af4f93e1
commit 83b03c0047
2 changed files with 4 additions and 5 deletions

View file

@ -261,10 +261,7 @@ NS_ASSUME_NONNULL_BEGIN
result.height += self.topVMargin;
result.height += self.bottomVMargin;
self.titleLabel.font = [self titleFont];
[self applyTitleForInteraction:interaction label:self.titleLabel];
self.titleLabel.numberOfLines = 0;
self.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
CGFloat maxTitleWidth = (collectionViewWidth - ([self hMargin] * 2.f + [self hSpacing] + [self iconSize]));
CGSize titleSize = [self.titleLabel sizeThatFits:CGSizeMake(maxTitleWidth, CGFLOAT_MAX)];
CGFloat contentHeight = ceil(MAX([self iconSize], titleSize.height));

View file

@ -75,13 +75,11 @@ NS_ASSUME_NONNULL_BEGIN
[self.bannerView addSubview:self.bannerBottomHighlightView2];
self.titleLabel = [UILabel new];
self.titleLabel.text = [self titleForInteraction:self.interaction];
self.titleLabel.textColor = [UIColor colorWithRGBHex:0x403e3b];
self.titleLabel.font = [self titleFont];
[self.bannerView addSubview:self.titleLabel];
self.subtitleLabel = [UILabel new];
self.subtitleLabel.text = [self subtitleForInteraction:self.interaction];
self.subtitleLabel.textColor = [UIColor ows_infoMessageBorderColor];
self.subtitleLabel.font = [self subtitleFont];
self.subtitleLabel.numberOfLines = 0;
@ -101,6 +99,9 @@ NS_ASSUME_NONNULL_BEGIN
_interaction = interaction;
self.titleLabel.text = [self titleForInteraction:self.interaction];
self.subtitleLabel.text = [self subtitleForInteraction:self.interaction];
self.backgroundColor = [UIColor whiteColor];
[self setNeedsLayout];
@ -225,6 +226,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *label = self.titleLabel;
label.font = [self titleFont];
label.text = title;
label.numberOfLines = 1;
result.height += ceil([label sizeThatFits:CGSizeZero].height);
if (subtitle.length > 0) {