From 78705d3ac13a26e6827941f988239002877afcc7 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 5 Apr 2017 16:32:34 -0400 Subject: [PATCH] right align blocked indicator // FREEBIE --- Signal/src/views/ContactTableViewCell.m | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Signal/src/views/ContactTableViewCell.m b/Signal/src/views/ContactTableViewCell.m index ca9271f4c..c94334544 100644 --- a/Signal/src/views/ContactTableViewCell.m +++ b/Signal/src/views/ContactTableViewCell.m @@ -71,16 +71,19 @@ NS_ASSUME_NONNULL_BEGIN NSMutableAttributedString *attributedText = [[contactsManager formattedFullNameForContact:contact font:self.nameLabel.font] mutableCopy]; if (self.isBlocked) { - // Add whitespace between the contact name and the blocked indicator. - [attributedText appendAttributedString:[[NSAttributedString alloc] initWithString:@" " attributes:nil]]; - [attributedText appendAttributedString:[[NSAttributedString alloc] - initWithString:NSLocalizedString(@"CONTACT_BLOCKED_INDICATOR", - @"An indicator that a contact has been blocked.") - attributes:@{ - NSFontAttributeName : [UIFont - ows_mediumFontWithSize:self.nameLabel.font.pointSize], - NSForegroundColorAttributeName : [UIColor blackColor], - }]]; + UILabel *blockedLabel = [[UILabel alloc] init]; + blockedLabel.textAlignment = NSTextAlignmentRight; + blockedLabel.text + = NSLocalizedString(@"CONTACT_BLOCKED_INDICATOR", @"An indicator that a contact has been blocked."); + blockedLabel.font = [UIFont ows_mediumFontWithSize:self.nameLabel.font.pointSize]; + blockedLabel.textColor = [UIColor blackColor]; + [self addSubview:blockedLabel]; + [blockedLabel sizeToFit]; + [blockedLabel autoVCenterInSuperview]; + [blockedLabel autoPinEdgeToSuperviewMargin:ALEdgeRight]; + [blockedLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:self.textLabel]; + + self.accessoryView = blockedLabel; } self.nameLabel.attributedText = attributedText; self.avatarView.image =