Scale home view cells to reflect dynamic type size.

pull/1/head
Matthew Chen 7 years ago
parent 543c898dbe
commit 3688d57eac

@ -82,8 +82,17 @@ NS_ASSUME_NONNULL_BEGIN
self.payloadView.axis = UILayoutConstraintAxisVertical; self.payloadView.axis = UILayoutConstraintAxisVertical;
[self.contentView addSubview:self.payloadView]; [self.contentView addSubview:self.payloadView];
[self.payloadView autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:self.avatarHSpacing]; [self.payloadView autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:self.avatarHSpacing];
[self.payloadView autoVCenterInSuperview];
[self.payloadView autoPinTrailingToSuperviewMarginWithInset:self.cellHMargin]; [self.payloadView autoPinTrailingToSuperviewMarginWithInset:self.cellHMargin];
[self.payloadView autoVCenterInSuperview];
// Ensure that the cell's contents never overflow the cell bounds.
[self.payloadView.bottomAnchor
constraintLessThanOrEqualToAnchor:self.payloadView.superview.layoutMarginsGuide.bottomAnchor]
.active
= YES;
[self.payloadView.topAnchor
constraintGreaterThanOrEqualToAnchor:self.payloadView.superview.layoutMarginsGuide.topAnchor]
.active
= YES;
self.nameLabel = [UILabel new]; self.nameLabel = [UILabel new];
self.nameLabel.lineBreakMode = NSLineBreakByTruncatingTail; self.nameLabel.lineBreakMode = NSLineBreakByTruncatingTail;
@ -95,13 +104,13 @@ NS_ASSUME_NONNULL_BEGIN
[self.dateTimeLabel setContentHuggingHorizontalHigh]; [self.dateTimeLabel setContentHuggingHorizontalHigh];
[self.dateTimeLabel setCompressionResistanceHorizontalHigh]; [self.dateTimeLabel setCompressionResistanceHorizontalHigh];
UIStackView *topRowView = [[UIStackView alloc] initWithArrangedSubviews:@[ self.topRowView = [[UIStackView alloc] initWithArrangedSubviews:@[
self.nameLabel, self.nameLabel,
self.dateTimeLabel, self.dateTimeLabel,
]]; ]];
self.topRowView = topRowView; self.topRowView.axis = UILayoutConstraintAxisHorizontal;
topRowView.axis = UILayoutConstraintAxisHorizontal; self.topRowView.alignment = UIStackViewAlignmentCenter;
[self.payloadView addArrangedSubview:topRowView]; [self.payloadView addArrangedSubview:self.topRowView];
self.snippetLabel = [UILabel new]; self.snippetLabel = [UILabel new];
self.snippetLabel.font = [self snippetFont]; self.snippetLabel.font = [self snippetFont];
@ -331,9 +340,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (CGFloat)rowHeight + (CGFloat)rowHeight
{ {
const NSUInteger kMinCellHeight = 72; return 72;
return CeilEven([self scaleValueWithDynamicType:kMinCellHeight]);
} }
- (NSUInteger)cellHMargin - (NSUInteger)cellHMargin

Loading…
Cancel
Save