diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.m b/Signal/src/ViewControllers/HomeView/HomeViewCell.m index bef284b6c..02705e9c8 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.m @@ -59,11 +59,8 @@ NS_ASSUME_NONNULL_BEGIN { OWSAssert(!self.avatarView); - const CGFloat kMinVMargin = 5; - [self setTranslatesAutoresizingMaskIntoConstraints:NO]; - self.layoutMargins = UIEdgeInsetsMake(0, self.cellHMargin, 0, self.cellHMargin); - self.contentView.layoutMargins = UIEdgeInsetsZero; + self.preservesSuperviewLayoutMargins = YES; self.contentView.preservesSuperviewLayoutMargins = YES; self.backgroundColor = [UIColor whiteColor]; @@ -79,13 +76,9 @@ NS_ASSUME_NONNULL_BEGIN [self.avatarView autoVCenterInSuperview]; [self.avatarView setContentHuggingHigh]; [self.avatarView setCompressionResistanceHigh]; - const CGFloat kAvatarMinVMargin = 10; - [self.avatarView autoPinEdgeToSuperviewEdge:ALEdgeTop - withInset:kAvatarMinVMargin - relation:NSLayoutRelationGreaterThanOrEqual]; - [self.avatarView autoPinEdgeToSuperviewEdge:ALEdgeBottom - withInset:kAvatarMinVMargin - relation:NSLayoutRelationGreaterThanOrEqual]; + // Ensure that the cell's contents never overflow the cell bounds. + [self.avatarView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual]; + [self.avatarView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual]; self.payloadView = [UIStackView new]; self.payloadView.axis = UILayoutConstraintAxisVertical; @@ -93,14 +86,8 @@ NS_ASSUME_NONNULL_BEGIN [self.payloadView autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:self.avatarHSpacing]; [self.payloadView autoVCenterInSuperview]; // Ensure that the cell's contents never overflow the cell bounds. - // We pin to the superview _edge_ and not _margin_ for the purposes - // of overflow, so that changes to the margins do not trip these safe guards. - [self.payloadView autoPinEdgeToSuperviewEdge:ALEdgeTop - withInset:kMinVMargin - relation:NSLayoutRelationGreaterThanOrEqual]; - [self.payloadView autoPinEdgeToSuperviewEdge:ALEdgeBottom - withInset:kMinVMargin - relation:NSLayoutRelationGreaterThanOrEqual]; + [self.payloadView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual]; + [self.payloadView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual]; // We pin the payloadView traillingEdge later, as part of the "Unread Badge" logic. self.nameLabel = [UILabel new]; @@ -410,11 +397,6 @@ NS_ASSUME_NONNULL_BEGIN return minValue * alpha; } -- (NSUInteger)cellHMargin -{ - return 16; -} - - (NSUInteger)avatarSize { return 48.f; diff --git a/SignalMessaging/Views/ContactTableViewCell.m b/SignalMessaging/Views/ContactTableViewCell.m index 3e0d3e886..87b9d3333 100644 --- a/SignalMessaging/Views/ContactTableViewCell.m +++ b/SignalMessaging/Views/ContactTableViewCell.m @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN -const NSUInteger kContactTableViewCellAvatarSize = 40; +const NSUInteger kContactTableViewCellAvatarSize = 48; const CGFloat kContactTableViewCellAvatarTextMargin = 12; @interface ContactTableViewCell () @@ -53,8 +53,6 @@ const CGFloat kContactTableViewCellAvatarTextMargin = 12; { OWSAssert(!self.nameLabel); - const CGFloat kMinVMargin = 5; - self.preservesSuperviewLayoutMargins = YES; self.contentView.preservesSuperviewLayoutMargins = YES; @@ -99,20 +97,10 @@ const CGFloat kContactTableViewCellAvatarTextMargin = 12; [_nameContainerView autoPinTrailingToSuperviewMargin]; // Ensure that the cell's contents never overflow the cell bounds. - // We pin to the superview _edge_ and not _margin_ for the purposes - // of overflow, so that changes to the margins do not trip these safe guards. - [_avatarView autoPinEdgeToSuperviewEdge:ALEdgeTop - withInset:kMinVMargin - relation:NSLayoutRelationGreaterThanOrEqual]; - [_avatarView autoPinEdgeToSuperviewEdge:ALEdgeBottom - withInset:kMinVMargin - relation:NSLayoutRelationGreaterThanOrEqual]; - [_nameContainerView autoPinEdgeToSuperviewEdge:ALEdgeTop - withInset:kMinVMargin - relation:NSLayoutRelationGreaterThanOrEqual]; - [_nameContainerView autoPinEdgeToSuperviewEdge:ALEdgeBottom - withInset:kMinVMargin - relation:NSLayoutRelationGreaterThanOrEqual]; + [self.avatarView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual]; + [self.avatarView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual]; + [self.nameContainerView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual]; + [self.nameContainerView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual]; [self configureFonts];