diff --git a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m index 97b37ab0f..241459a56 100644 --- a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m @@ -237,7 +237,7 @@ [cell.contentView addSubview:button]; [button autoSetDimension:ALDimensionHeight toSize:kButtonHeight]; [button autoVCenterInSuperview]; - [button autoPinLeadingAndTrailingToSuperview]; + [button autoPinLeadingAndTrailingToSuperviewMargin]; return cell; } @@ -270,7 +270,7 @@ } [cell.contentView addSubview:avatarView]; [avatarView autoVCenterInSuperview]; - [avatarView autoPinLeadingToSuperview]; + [avatarView autoPinLeadingToSuperviewMargin]; [avatarView autoSetDimension:ALDimensionWidth toSize:kAvatarSize]; [avatarView autoSetDimension:ALDimensionHeight toSize:kAvatarSize]; @@ -278,14 +278,14 @@ UIImage *cameraImage = [UIImage imageNamed:@"settings-avatar-camera"]; UIImageView *cameraImageView = [[UIImageView alloc] initWithImage:cameraImage]; [cell.contentView addSubview:cameraImageView]; - [cameraImageView autoPinTrailingToView:avatarView]; + [cameraImageView autoPinTrailingToEdgeOfView:avatarView]; [cameraImageView autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:avatarView]; } UIView *nameView = [UIView containerView]; [cell.contentView addSubview:nameView]; [nameView autoVCenterInSuperview]; - [nameView autoPinLeadingToTrailingOfView:avatarView margin:16.f]; + [nameView autoPinLeadingToTrailingEdgeOfView:avatarView offset:16.f]; UILabel *titleLabel = [UILabel new]; NSString *_Nullable localProfileName = [OWSProfileManager.sharedManager localProfileName]; @@ -314,7 +314,7 @@ subtitleLabel.lineBreakMode = NSLineBreakByTruncatingTail; [nameView addSubview:subtitleLabel]; [subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:titleLabel]; - [subtitleLabel autoPinLeadingToSuperview]; + [subtitleLabel autoPinLeadingToSuperviewMargin]; [subtitleLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom]; UIImage *disclosureImage = [UIImage imageNamed:(self.view.isRTL ? @"NavBarBack" : @"NavBarBackRTL")]; @@ -324,8 +324,8 @@ disclosureButton.tintColor = [UIColor colorWithRGBHex:0xcccccc]; [cell.contentView addSubview:disclosureButton]; [disclosureButton autoVCenterInSuperview]; - [disclosureButton autoPinTrailingToSuperview]; - [disclosureButton autoPinLeadingToTrailingOfView:nameView margin:16.f]; + [disclosureButton autoPinTrailingToSuperviewMargin]; + [disclosureButton autoPinLeadingToTrailingEdgeOfView:nameView offset:16.f]; [disclosureButton setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh + 1) forAxis:UILayoutConstraintAxisHorizontal]; diff --git a/Signal/src/ViewControllers/CallViewController.swift b/Signal/src/ViewControllers/CallViewController.swift index 552898052..968fa5fd5 100644 --- a/Signal/src/ViewControllers/CallViewController.swift +++ b/Signal/src/ViewControllers/CallViewController.swift @@ -543,7 +543,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, // Dark blurred background. blurView.autoPinEdgesToSuperviewEdges() - localVideoView.autoPinTrailingToSuperview(withMargin: videoPreviewHMargin) + localVideoView.autoPinTrailingToSuperviewMargin(withInset: videoPreviewHMargin) localVideoView.autoPinEdge(toSuperviewEdge: .top, withInset: topMargin) let localVideoSize = ScaleFromIPhone5To7Plus(80, 100) localVideoView.autoSetDimension(.width, toSize: localVideoSize) @@ -552,12 +552,12 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, remoteVideoView.autoPinEdgesToSuperviewEdges() contactNameLabel.autoPinEdge(toSuperviewEdge: .top, withInset: topMargin) - contactNameLabel.autoPinLeadingToSuperview(withMargin: contactHMargin) + contactNameLabel.autoPinLeadingToSuperviewMargin(withInset: contactHMargin) contactNameLabel.setContentHuggingVerticalHigh() contactNameLabel.setCompressionResistanceHigh() callStatusLabel.autoPinEdge(.top, to: .bottom, of: contactNameLabel, withOffset: contactVSpacing) - callStatusLabel.autoPinLeadingToSuperview(withMargin: contactHMargin) + callStatusLabel.autoPinLeadingToSuperviewMargin(withInset: contactHMargin) callStatusLabel.setContentHuggingVerticalHigh() callStatusLabel.setCompressionResistanceHigh() @@ -613,12 +613,12 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, if localVideoView.isHidden { let contactHMargin = CGFloat(5) - constraints.append(contactNameLabel.autoPinTrailingToSuperview(withMargin: contactHMargin)) - constraints.append(callStatusLabel.autoPinTrailingToSuperview(withMargin: contactHMargin)) + constraints.append(contactNameLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin)) + constraints.append(callStatusLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin)) } else { let spacing = CGFloat(10) - constraints.append(localVideoView.autoPinLeading(toTrailingOf: contactNameLabel, margin: spacing)) - constraints.append(localVideoView.autoPinLeading(toTrailingOf: callStatusLabel, margin: spacing)) + constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: contactNameLabel, offset: spacing)) + constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: callStatusLabel, offset: spacing)) } self.localVideoConstraints = constraints diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m index 18c496729..4e3c8c966 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m @@ -203,15 +203,15 @@ NS_ASSUME_NONNULL_BEGIN UIView *contentView = [UIView containerView]; [self addSubview:contentView]; - [contentView autoPinLeadingToSuperviewWithMargin:self.isIncoming ? kBubbleTailWidth : 0.f]; - [contentView autoPinTrailingToSuperviewWithMargin:self.isIncoming ? 0.f : kBubbleTailWidth]; + [contentView autoPinLeadingToSuperviewMarginWithInset:self.isIncoming ? kBubbleTailWidth : 0.f]; + [contentView autoPinTrailingToSuperviewMarginWithInset:self.isIncoming ? 0.f : kBubbleTailWidth]; [contentView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:self.audioIconVMargin]; [contentView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.audioIconVMargin]; _audioPlayPauseButton = [UIButton buttonWithType:UIButtonTypeCustom]; self.audioPlayPauseButton.enabled = NO; [contentView addSubview:self.audioPlayPauseButton]; - [self.audioPlayPauseButton autoPinLeadingToSuperviewWithMargin:self.audioIconHMargin]; + [self.audioPlayPauseButton autoPinLeadingToSuperviewMarginWithInset:self.audioIconHMargin]; [self.audioPlayPauseButton autoVCenterInSuperview]; [self.audioPlayPauseButton autoSetDimension:ALDimensionWidth toSize:self.iconSize]; [self.audioPlayPauseButton autoSetDimension:ALDimensionHeight toSize:self.iconSize]; @@ -220,8 +220,8 @@ NS_ASSUME_NONNULL_BEGIN UIView *labelsView = [UIView containerView]; [contentView addSubview:labelsView]; - [labelsView autoPinLeadingToTrailingOfView:self.audioPlayPauseButton margin:kLabelHSpacing]; - [labelsView autoPinTrailingToSuperviewWithMargin:self.audioIconHMargin]; + [labelsView autoPinLeadingToTrailingEdgeOfView:self.audioPlayPauseButton offset:kLabelHSpacing]; + [labelsView autoPinTrailingToSuperviewMarginWithInset:self.audioIconHMargin]; [labelsView autoVCenterInSuperview]; const CGFloat kLabelVSpacing = 2; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m index 65c8a9ae1..ccc92cb1d 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m @@ -113,8 +113,8 @@ NS_ASSUME_NONNULL_BEGIN UIView *contentView = [UIView containerView]; [self addSubview:contentView]; - [contentView autoPinLeadingToSuperviewWithMargin:self.isIncoming ? kBubbleTailWidth : 0.f]; - [contentView autoPinTrailingToSuperviewWithMargin:self.isIncoming ? 0.f : kBubbleTailWidth]; + [contentView autoPinLeadingToSuperviewMarginWithInset:self.isIncoming ? kBubbleTailWidth : 0.f]; + [contentView autoPinTrailingToSuperviewMarginWithInset:self.isIncoming ? 0.f : kBubbleTailWidth]; [contentView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:self.vMargin]; [contentView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.vMargin]; @@ -126,7 +126,7 @@ NS_ASSUME_NONNULL_BEGIN layer.fillColor = iconColor.CGColor; }; [contentView addSubview:iconCircleView]; - [iconCircleView autoPinLeadingToSuperviewWithMargin:self.iconHMargin]; + [iconCircleView autoPinLeadingToSuperviewMarginWithInset:self.iconHMargin]; [iconCircleView autoVCenterInSuperview]; [iconCircleView autoSetDimension:ALDimensionWidth toSize:self.iconSize]; [iconCircleView autoSetDimension:ALDimensionHeight toSize:self.iconSize]; @@ -145,8 +145,8 @@ NS_ASSUME_NONNULL_BEGIN const CGFloat kLabelHSpacing = self.iconHSpacing; UIView *labelsView = [UIView containerView]; [contentView addSubview:labelsView]; - [labelsView autoPinLeadingToTrailingOfView:imageView margin:kLabelHSpacing]; - [labelsView autoPinTrailingToSuperviewWithMargin:self.iconHMargin]; + [labelsView autoPinLeadingToTrailingEdgeOfView:imageView offset:kLabelHSpacing]; + [labelsView autoPinTrailingToSuperviewMarginWithInset:self.iconHMargin]; [labelsView autoVCenterInSuperview]; NSString *filename = self.attachmentStream.sourceFilename; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index 0f0eedb25..ee0a5196a 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -318,17 +318,17 @@ CG_INLINE CGSize CGSizeCeil(CGSize size) [self.contentView addSubview:self.failedSendBadgeView]; [self.viewConstraints addObjectsFromArray:@[ - [self.bubbleView autoPinLeadingToSuperview], - [self.failedSendBadgeView autoPinLeadingToTrailingOfView:self.bubbleView], + [self.bubbleView autoPinLeadingToSuperviewMargin], + [self.failedSendBadgeView autoPinLeadingToTrailingEdgeOfView:self.bubbleView], [self.failedSendBadgeView autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.bubbleView], - [self.failedSendBadgeView autoPinTrailingToSuperview], + [self.failedSendBadgeView autoPinTrailingToSuperviewMargin], [self.failedSendBadgeView autoSetDimension:ALDimensionWidth toSize:self.failedSendBadgeSize], [self.failedSendBadgeView autoSetDimension:ALDimensionHeight toSize:self.failedSendBadgeSize], ]]; } else { [self.viewConstraints addObjectsFromArray:@[ - [self.bubbleView autoPinLeadingToSuperview], - [self.bubbleView autoPinTrailingToSuperview], + [self.bubbleView autoPinLeadingToSuperviewMargin], + [self.bubbleView autoPinTrailingToSuperviewMargin], ]]; } @@ -400,8 +400,8 @@ CG_INLINE CGSize CGSizeCeil(CGSize size) // roughly a square. // TODO: Myles is considering alternatives. [self.viewConstraints addObjectsFromArray:@[ - [bodyMediaView autoPinLeadingToSuperviewWithMargin:0], - [bodyMediaView autoPinTrailingToSuperviewWithMargin:0], + [bodyMediaView autoPinLeadingToSuperviewMarginWithInset:0], + [bodyMediaView autoPinTrailingToSuperviewMarginWithInset:0], ]]; // We need constraints to control the vertical sizing of media and text views, but we use // lower priority so that when a message only contains media it uses the exact bounds of @@ -448,8 +448,8 @@ CG_INLINE CGSize CGSizeCeil(CGSize size) if (bodyTextView) { [self.bubbleView addSubview:bodyTextView]; [self.viewConstraints addObjectsFromArray:@[ - [bodyTextView autoPinLeadingToSuperviewWithMargin:self.textLeadingMargin], - [bodyTextView autoPinTrailingToSuperviewWithMargin:self.textTrailingMargin], + [bodyTextView autoPinLeadingToSuperviewMarginWithInset:self.textLeadingMargin], + [bodyTextView autoPinTrailingToSuperviewMarginWithInset:self.textTrailingMargin], ]]; // We need constraints to control the vertical sizing of media and text views, but we use // lower priority so that when a message only contains media it uses the exact bounds of @@ -479,8 +479,8 @@ CG_INLINE CGSize CGSizeCeil(CGSize size) OWSAssert(lastSubview == bodyTextView); [self.bubbleView addSubview:tapForMoreLabel]; [self.viewConstraints addObjectsFromArray:@[ - [tapForMoreLabel autoPinLeadingToSuperviewWithMargin:self.textLeadingMargin], - [tapForMoreLabel autoPinTrailingToSuperviewWithMargin:self.textTrailingMargin], + [tapForMoreLabel autoPinLeadingToSuperviewMarginWithInset:self.textLeadingMargin], + [tapForMoreLabel autoPinTrailingToSuperviewMarginWithInset:self.textTrailingMargin], [tapForMoreLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:lastSubview], [tapForMoreLabel autoSetDimension:ALDimensionHeight toSize:self.tapForMoreHeight], ]]; @@ -685,24 +685,24 @@ CG_INLINE CGSize CGSizeCeil(CGSize size) [self.viewConstraints addObjectsFromArray:@[ [self.expirationTimerView autoVCenterInSuperview], [self.footerLabel autoVCenterInSuperview], - (self.isIncoming ? [self.expirationTimerView autoPinLeadingToSuperview] - : [self.expirationTimerView autoPinTrailingToSuperview]), - (self.isIncoming ? [self.footerLabel autoPinLeadingToTrailingOfView:self.expirationTimerView margin:0.f] - : [self.footerLabel autoPinTrailingToLeadingOfView:self.expirationTimerView margin:0.f]), + (self.isIncoming ? [self.expirationTimerView autoPinLeadingToSuperviewMargin] + : [self.expirationTimerView autoPinTrailingToSuperviewMargin]), + (self.isIncoming ? [self.footerLabel autoPinLeadingToTrailingEdgeOfView:self.expirationTimerView offset:0.f] + : [self.footerLabel autoPinTrailingToLeadingEdgeOfView:self.expirationTimerView offset:0.f]), [self.footerView autoSetDimension:ALDimensionHeight toSize:self.footerHeight], ]]; } else if (hasExpirationTimer) { [self.viewConstraints addObjectsFromArray:@[ [self.expirationTimerView autoVCenterInSuperview], - (self.isIncoming ? [self.expirationTimerView autoPinLeadingToSuperview] - : [self.expirationTimerView autoPinTrailingToSuperview]), + (self.isIncoming ? [self.expirationTimerView autoPinLeadingToSuperviewMargin] + : [self.expirationTimerView autoPinTrailingToSuperviewMargin]), [self.footerView autoSetDimension:ALDimensionHeight toSize:self.footerHeight], ]]; } else if (attributedText) { [self.viewConstraints addObjectsFromArray:@[ [self.footerLabel autoVCenterInSuperview], - (self.isIncoming ? [self.footerLabel autoPinLeadingToSuperview] - : [self.footerLabel autoPinTrailingToSuperview]), + (self.isIncoming ? [self.footerLabel autoPinLeadingToSuperviewMargin] + : [self.footerLabel autoPinTrailingToSuperviewMargin]), [self.footerView autoSetDimension:ALDimensionHeight toSize:self.footerHeight], ]]; } else { diff --git a/Signal/src/ViewControllers/ConversationView/ConversationInputTextView.m b/Signal/src/ViewControllers/ConversationView/ConversationInputTextView.m index cc2c4a8c8..86885e0eb 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationInputTextView.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationInputTextView.m @@ -106,8 +106,8 @@ NS_ASSUME_NONNULL_BEGIN CGFloat topInset = beginningTextRect.origin.y; self.placeholderConstraints = @[ - [self.placeholderView autoPinLeadingToSuperview], - [self.placeholderView autoPinTrailingToSuperview], + [self.placeholderView autoPinLeadingToSuperviewMargin], + [self.placeholderView autoPinTrailingToSuperviewMargin], [self.placeholderView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:topInset], ]; } diff --git a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m index fa1cccf24..f0fa8c664 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m @@ -415,26 +415,26 @@ static const CGFloat ConversationInputToolbarBorderViewHeight = 0.5; self.contentContraints = @[ [self.leftButtonWrapper autoPinEdgeToSuperviewEdge:ALEdgeLeft], [self.leftButtonWrapper autoPinEdgeToSuperviewEdge:ALEdgeTop], - [self.leftButtonWrapper autoPinBottomToSuperviewWithMargin:0], + [self.leftButtonWrapper autoPinBottomToSuperviewMarginWithInset:0], [leftButton autoSetDimension:ALDimensionHeight toSize:kMinContentHeight], - [leftButton autoPinLeadingToSuperviewWithMargin:contentHInset], - [leftButton autoPinTrailingToSuperviewWithMargin:contentHSpacing], + [leftButton autoPinLeadingToSuperviewMarginWithInset:contentHInset], + [leftButton autoPinTrailingToSuperviewMarginWithInset:contentHSpacing], [leftButton autoPinEdgeToSuperviewEdge:ALEdgeBottom], [self.inputTextView autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:self.leftButtonWrapper], [self.inputTextView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:textViewVInset], - [self.inputTextView autoPinBottomToSuperviewWithMargin:textViewVInset], + [self.inputTextView autoPinBottomToSuperviewMarginWithInset:textViewVInset], [self.inputTextView autoSetDimension:ALDimensionHeight toSize:textViewHeight], [self.rightButtonWrapper autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:self.inputTextView], [self.rightButtonWrapper autoPinEdgeToSuperviewEdge:ALEdgeRight], [self.rightButtonWrapper autoPinEdgeToSuperviewEdge:ALEdgeTop], - [self.rightButtonWrapper autoPinBottomToSuperviewWithMargin:0], + [self.rightButtonWrapper autoPinBottomToSuperviewMarginWithInset:0], [rightButton autoSetDimension:ALDimensionHeight toSize:kMinContentHeight], - [rightButton autoPinLeadingToSuperviewWithMargin:contentHSpacing], - [rightButton autoPinTrailingToSuperviewWithMargin:contentHInset], + [rightButton autoPinLeadingToSuperviewMarginWithInset:contentHSpacing], + [rightButton autoPinTrailingToSuperviewMarginWithInset:contentHInset], [rightButton autoPinEdgeToSuperviewEdge:ALEdgeBottom] ]; @@ -616,9 +616,9 @@ static const CGFloat ConversationInputToolbarBorderViewHeight = 0.5; [whiteIconView autoCenterInSuperview]; [imageView autoVCenterInSuperview]; - [imageView autoPinLeadingToSuperviewWithMargin:10.f]; + [imageView autoPinLeadingToSuperviewMarginWithInset:10.f]; [self.recordingLabel autoVCenterInSuperview]; - [self.recordingLabel autoPinLeadingToTrailingOfView:imageView margin:5.f]; + [self.recordingLabel autoPinLeadingToTrailingEdgeOfView:imageView offset:5.f]; [cancelLabel autoVCenterInSuperview]; [cancelLabel autoHCenterInSuperview]; [self.voiceMemoUI setNeedsLayout]; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 3fd6eb174..4d1d258f8 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -816,7 +816,7 @@ typedef enum : NSUInteger { [bannerView addSubview:closeButton]; const CGFloat kBannerCloseButtonPadding = 8.f; [closeButton autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:kBannerCloseButtonPadding]; - [closeButton autoPinTrailingToSuperviewWithMargin:kBannerCloseButtonPadding]; + [closeButton autoPinTrailingToSuperviewMarginWithInset:kBannerCloseButtonPadding]; [closeButton autoSetDimension:ALDimensionWidth toSize:closeIcon.size.width]; [closeButton autoSetDimension:ALDimensionHeight toSize:closeIcon.size.height]; @@ -824,9 +824,9 @@ typedef enum : NSUInteger { [label autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:5]; [label autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:5]; const CGFloat kBannerHPadding = 15.f; - [label autoPinLeadingToSuperviewWithMargin:kBannerHPadding]; + [label autoPinLeadingToSuperviewMarginWithInset:kBannerHPadding]; const CGFloat kBannerHSpacing = 10.f; - [closeButton autoPinLeadingToTrailingOfView:label margin:kBannerHSpacing]; + [closeButton autoPinLeadingToTrailingEdgeOfView:label offset:kBannerHSpacing]; [bannerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:tapSelector]]; @@ -1174,7 +1174,7 @@ typedef enum : NSUInteger { // bar button items, but it means we'll probably need separate RTL and LTR // flavors of these assets. [_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:-6]; - [_backButtonUnreadCountView autoPinLeadingToSuperviewWithMargin:1]; + [_backButtonUnreadCountView autoPinLeadingToSuperviewMarginWithInset:1]; [_backButtonUnreadCountView autoSetDimension:ALDimensionHeight toSize:self.unreadCountViewDiameter]; // We set a min width, but we will also pin to our subview label, so we can grow to accommodate multiple digits. [_backButtonUnreadCountView autoSetDimension:ALDimensionWidth diff --git a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift index a3b0365ee..72b1f3ba0 100644 --- a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift +++ b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift @@ -71,7 +71,7 @@ private class IntroducingCustomNotificationAudioExperienceUpgradeViewController: // Title label layout titleLabel.autoSetDimension(.height, toSize: ScaleFromIPhone5(40)) titleLabel.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5To7Plus(16, 24)) - titleLabel.autoPinTopToSuperview() + titleLabel.autoPinTopToSuperviewMargin() // Body label layout bodyLabel.autoPinEdge(.top, to: .bottom, of: imageView, withOffset: ScaleFromIPhone5To7Plus(18, 28)) @@ -181,7 +181,7 @@ private class IntroductingReadReceiptsExperienceUpgradeViewController: Experienc // Title label layout titleLabel.autoSetDimension(.height, toSize: ScaleFromIPhone5(40)) titleLabel.autoPinWidthToSuperview(withMargin: ScaleFromIPhone5To7Plus(16, 24)) - titleLabel.autoPinTopToSuperview() + titleLabel.autoPinTopToSuperviewMargin() // Body label layout bodyLabel.autoPinEdge(.top, to: .bottom, of: imageView, withOffset: ScaleFromIPhone5To7Plus(18, 28)) @@ -574,19 +574,19 @@ class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControl statusBarBackgroundView.autoPinEdge(.bottom, to: .top, of: headerBackgroundView) headerBackgroundView.autoPinWidthToSuperview() - headerBackgroundView.autoPinTopToSuperview() + headerBackgroundView.autoPinTopToSuperviewMargin() headerBackgroundView.autoSetDimension(.height, toSize: ScaleFromIPhone5(60)) // Dismiss button layout dismissButton.autoHCenterInSuperview() - dismissButton.autoPinBottomToSuperview(withMargin: ScaleFromIPhone5(10)) + dismissButton.autoPinBottomToSuperviewMargin(withInset: ScaleFromIPhone5(10)) // Carousel View layout carouselView.autoPinWidthToSuperview() // negative inset so as to overlay the header text in the carousel view with the header background which // lives outside of the carousel. We do this so that the user can't bounce past the page view controllers // width limits, exposing the edge of the header. - carouselView.autoPinTopToSuperview(withMargin: ScaleFromIPhone5To7Plus(14, 24)) + carouselView.autoPinTopToSuperviewMargin(withInset: ScaleFromIPhone5To7Plus(14, 24)) carouselView.autoPinEdge(.bottom, to: .top, of: dismissButton, withOffset: ScaleFromIPhone5(-10)) } diff --git a/Signal/src/ViewControllers/InboxTableViewCell.m b/Signal/src/ViewControllers/InboxTableViewCell.m index ed7fa9617..fb53a4b66 100644 --- a/Signal/src/ViewControllers/InboxTableViewCell.m +++ b/Signal/src/ViewControllers/InboxTableViewCell.m @@ -73,14 +73,14 @@ const NSUInteger kAvatarViewDiameter = 52; [self.contentView addSubview:self.avatarView]; [self.avatarView autoSetDimension:ALDimensionWidth toSize:self.avatarSize]; [self.avatarView autoSetDimension:ALDimensionHeight toSize:self.avatarSize]; - [self.avatarView autoPinLeadingToSuperview]; + [self.avatarView autoPinLeadingToSuperviewMargin]; [self.avatarView autoVCenterInSuperview]; self.nameLabel = [UILabel new]; self.nameLabel.lineBreakMode = NSLineBreakByTruncatingTail; self.nameLabel.font = [UIFont ows_boldFontWithSize:14.0f]; [self.contentView addSubview:self.nameLabel]; - [self.nameLabel autoPinLeadingToTrailingOfView:self.avatarView margin:13.f]; + [self.nameLabel autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:13.f]; [self.nameLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:self.avatarView]; [self.nameLabel setContentHuggingHorizontalLow]; @@ -91,7 +91,7 @@ const NSUInteger kAvatarViewDiameter = 52; self.snippetLabel.numberOfLines = 2; self.snippetLabel.lineBreakMode = NSLineBreakByTruncatingTail; [self.contentView addSubview:self.snippetLabel]; - [self.snippetLabel autoPinLeadingToTrailingOfView:self.avatarView margin:13.f]; + [self.snippetLabel autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:13.f]; [self.snippetLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.nameLabel withOffset:5.f]; [self.snippetLabel autoPinEdge:ALEdgeTrailing toEdge:ALEdgeTrailing ofView:self.nameLabel]; [self.snippetLabel setContentHuggingHorizontalLow]; @@ -99,9 +99,9 @@ const NSUInteger kAvatarViewDiameter = 52; self.timeLabel = [UILabel new]; self.timeLabel.font = [UIFont ows_lightFontWithSize:14.f]; [self.contentView addSubview:self.timeLabel]; - [self.timeLabel autoPinTrailingToSuperview]; + [self.timeLabel autoPinTrailingToSuperviewMargin]; [self.timeLabel autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.nameLabel]; - [self.timeLabel autoPinLeadingToTrailingOfView:self.nameLabel margin:10.f]; + [self.timeLabel autoPinLeadingToTrailingEdgeOfView:self.nameLabel offset:10.f]; [self.timeLabel setContentHuggingHorizontalHigh]; [self.timeLabel setCompressionResistanceHigh]; @@ -112,7 +112,7 @@ const NSUInteger kAvatarViewDiameter = 52; [self.contentView addSubview:self.unreadBadge]; [self.unreadBadge autoSetDimension:ALDimensionWidth toSize:kunreadBadgeSize]; [self.unreadBadge autoSetDimension:ALDimensionHeight toSize:kunreadBadgeSize]; - [self.unreadBadge autoPinTrailingToSuperview]; + [self.unreadBadge autoPinTrailingToSuperviewMargin]; [self.unreadBadge autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:self.avatarView]; [self.unreadBadge setContentHuggingHorizontalHigh]; [self.unreadBadge setCompressionResistanceHigh]; diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index f657d9af6..7ff130410 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -133,8 +133,8 @@ class MessageDetailViewController: OWSViewController, UIScrollViewDelegate, Medi let contentView = UIView.container() self.contentView = contentView scrollView.addSubview(contentView) - contentView.autoPinLeadingToSuperview() - contentView.autoPinTrailingToSuperview() + contentView.autoPinLeadingToSuperviewMargin() + contentView.autoPinTrailingToSuperviewMargin() contentView.autoPinEdge(toSuperviewEdge: .top) contentView.autoPinEdge(toSuperviewEdge: .bottom) scrollView.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) @@ -284,8 +284,8 @@ class MessageDetailViewController: OWSViewController, UIScrollViewDelegate, Medi var lastRow: UIView? for row in rows { contentView.addSubview(row) - row.autoPinLeadingToSuperview() - row.autoPinTrailingToSuperview() + row.autoPinLeadingToSuperviewMargin() + row.autoPinTrailingToSuperviewMargin() if let lastRow = lastRow { row.autoPinEdge(.top, to: .bottom, of: lastRow, withOffset: 5) @@ -526,9 +526,9 @@ class MessageDetailViewController: OWSViewController, UIScrollViewDelegate, Medi let valueLabel = self.valueLabel(text: value) row.addSubview(nameLabel) row.addSubview(valueLabel) - nameLabel.autoPinLeadingToSuperview(withMargin: 20) - valueLabel.autoPinTrailingToSuperview(withMargin: 20) - valueLabel.autoPinLeading(toTrailingOf: nameLabel, margin: 10) + nameLabel.autoPinLeadingToSuperviewMargin(withInset: 20) + valueLabel.autoPinTrailingToSuperviewMargin(withInset: 20) + valueLabel.autoPinLeading(toTrailingEdgeOf: nameLabel, offset: 10) nameLabel.autoPinEdge(toSuperviewEdge: .top) valueLabel.autoPinEdge(toSuperviewEdge: .top) @@ -536,8 +536,8 @@ class MessageDetailViewController: OWSViewController, UIScrollViewDelegate, Medi let subtitleLabel = self.valueLabel(text: subtitle) subtitleLabel.textColor = UIColor.ows_darkGray row.addSubview(subtitleLabel) - subtitleLabel.autoPinTrailingToSuperview() - subtitleLabel.autoPinLeading(toTrailingOf: nameLabel, margin: 10) + subtitleLabel.autoPinTrailingToSuperviewMargin() + subtitleLabel.autoPinLeading(toTrailingEdgeOf: nameLabel, offset: 10) subtitleLabel.autoPinEdge(.top, to: .bottom, of: valueLabel, withOffset: 1) subtitleLabel.autoPinEdge(toSuperviewEdge: .bottom) } else if value.count > 0 { diff --git a/Signal/src/ViewControllers/NewGroupViewController.m b/Signal/src/ViewControllers/NewGroupViewController.m index dd95b1a4e..335ae760f 100644 --- a/Signal/src/ViewControllers/NewGroupViewController.m +++ b/Signal/src/ViewControllers/NewGroupViewController.m @@ -146,7 +146,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68; [threadInfoView addSubview:avatarView]; [avatarView autoVCenterInSuperview]; - [avatarView autoPinLeadingToSuperview]; + [avatarView autoPinLeadingToSuperviewMargin]; [avatarView autoSetDimension:ALDimensionWidth toSize:kNewGroupViewControllerAvatarWidth]; [avatarView autoSetDimension:ALDimensionHeight toSize:kNewGroupViewControllerAvatarWidth]; [self updateAvatarView]; @@ -163,8 +163,8 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68; forControlEvents:UIControlEventEditingChanged]; [threadInfoView addSubview:groupNameTextField]; [groupNameTextField autoVCenterInSuperview]; - [groupNameTextField autoPinTrailingToSuperview]; - [groupNameTextField autoPinLeadingToTrailingOfView:avatarView margin:16.f]; + [groupNameTextField autoPinTrailingToSuperviewMargin]; + [groupNameTextField autoPinLeadingToTrailingEdgeOfView:avatarView offset:16.f]; [avatarView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarTouched:)]]; diff --git a/Signal/src/ViewControllers/OWS2FASettingsViewController.m b/Signal/src/ViewControllers/OWS2FASettingsViewController.m index 2246f503e..b8b246dda 100644 --- a/Signal/src/ViewControllers/OWS2FASettingsViewController.m +++ b/Signal/src/ViewControllers/OWS2FASettingsViewController.m @@ -186,7 +186,7 @@ NS_ASSUME_NONNULL_BEGIN [self createPinTextfield]; - [instructionsLabel autoPinTopToSuperviewWithMargin:kVSpacing]; + [instructionsLabel autoPinTopToSuperviewMarginWithInset:kVSpacing]; [instructionsLabel autoPinWidthToSuperviewWithMargin:self.hMargin]; [self.pinTextfield autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:instructionsLabel withOffset:kVSpacing]; diff --git a/Signal/src/ViewControllers/ProfileViewController.m b/Signal/src/ViewControllers/ProfileViewController.m index 8bb6c0c31..3d3d63e14 100644 --- a/Signal/src/ViewControllers/ProfileViewController.m +++ b/Signal/src/ViewControllers/ProfileViewController.m @@ -114,7 +114,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat nameLabel.textColor = [UIColor blackColor]; nameLabel.font = [UIFont ows_mediumFontWithSize:fontSizePoints]; [nameRow addSubview:nameLabel]; - [nameLabel autoPinLeadingToSuperview]; + [nameLabel autoPinLeadingToSuperviewMargin]; [nameLabel autoPinHeightToSuperviewWithMargin:5.f]; UITextField *nameTextField = [UITextField new]; @@ -129,8 +129,8 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat nameTextField.font = [UIFont ows_mediumFontWithSize:fontSizePoints]; [nameTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; [nameRow addSubview:nameTextField]; - [nameTextField autoPinLeadingToTrailingOfView:nameLabel margin:10.f]; - [nameTextField autoPinTrailingToSuperview]; + [nameTextField autoPinLeadingToTrailingEdgeOfView:nameLabel offset:10.f]; + [nameTextField autoPinTrailingToSuperviewMargin]; [nameTextField autoVCenterInSuperview]; // Avatar @@ -147,7 +147,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat avatarLabel.textColor = [UIColor blackColor]; avatarLabel.font = [UIFont ows_mediumFontWithSize:fontSizePoints]; [avatarRow addSubview:avatarLabel]; - [avatarLabel autoPinLeadingToSuperview]; + [avatarLabel autoPinLeadingToSuperviewMargin]; [avatarLabel autoVCenterInSuperview]; self.avatarView = [AvatarImageView new]; @@ -158,15 +158,15 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat [avatarRow addSubview:self.avatarView]; [avatarRow addSubview:self.cameraImageView]; [self updateAvatarView]; - [self.avatarView autoPinTrailingToSuperview]; - [self.avatarView autoPinLeadingToTrailingOfView:avatarLabel margin:10.f]; + [self.avatarView autoPinTrailingToSuperviewMargin]; + [self.avatarView autoPinLeadingToTrailingEdgeOfView:avatarLabel offset:10.f]; const CGFloat kAvatarSizePoints = 50.f; const CGFloat kAvatarVMargin = 4.f; [self.avatarView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:kAvatarVMargin]; [self.avatarView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:kAvatarVMargin]; [self.avatarView autoSetDimension:ALDimensionWidth toSize:kAvatarSizePoints]; [self.avatarView autoSetDimension:ALDimensionHeight toSize:kAvatarSizePoints]; - [self.cameraImageView autoPinTrailingToView:self.avatarView]; + [self.cameraImageView autoPinTrailingToEdgeOfView:self.avatarView]; [self.cameraImageView autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:self.avatarView]; // Information @@ -199,8 +199,8 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat infoLabel.numberOfLines = 0; infoLabel.lineBreakMode = NSLineBreakByWordWrapping; [infoRow addSubview:infoLabel]; - [infoLabel autoPinLeadingToSuperview]; - [infoLabel autoPinTrailingToSuperview]; + [infoLabel autoPinLeadingToSuperviewMargin]; + [infoLabel autoPinTrailingToSuperviewMargin]; [infoLabel autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:10.f]; [infoLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:10.f]; @@ -223,7 +223,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat selector:@selector(saveButtonPressed)]; self.saveButton = saveButton; [buttonRow addSubview:saveButton]; - [saveButton autoPinLeadingAndTrailingToSuperview]; + [saveButton autoPinLeadingAndTrailingToSuperviewMargin]; [saveButton autoPinHeightToSuperview]; [saveButton autoSetDimension:ALDimensionHeight toSize:47.f]; } @@ -238,8 +238,8 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat } else { [row autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:15.f]; } - [row autoPinLeadingToSuperviewWithMargin:18.f]; - [row autoPinTrailingToSuperviewWithMargin:18.f]; + [row autoPinLeadingToSuperviewMarginWithInset:18.f]; + [row autoPinTrailingToSuperviewMarginWithInset:18.f]; lastRow = row; if (lastRow == nameRow || lastRow == avatarRow) { @@ -247,8 +247,8 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat separator.backgroundColor = [UIColor colorWithWhite:0.9f alpha:1.f]; [contentView addSubview:separator]; [separator autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:lastRow withOffset:5.f]; - [separator autoPinLeadingToSuperviewWithMargin:18.f]; - [separator autoPinTrailingToSuperviewWithMargin:18.f]; + [separator autoPinLeadingToSuperviewMarginWithInset:18.f]; + [separator autoPinTrailingToSuperviewMarginWithInset:18.f]; [separator autoSetDimension:ALDimensionHeight toSize:1.f]; lastRow = separator; } diff --git a/Signal/src/ViewControllers/Registration/CodeVerificationViewController.m b/Signal/src/ViewControllers/Registration/CodeVerificationViewController.m index 1143b8edf..9124b9024 100644 --- a/Signal/src/ViewControllers/Registration/CodeVerificationViewController.m +++ b/Signal/src/ViewControllers/Registration/CodeVerificationViewController.m @@ -119,7 +119,7 @@ NS_ASSUME_NONNULL_BEGIN [backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; backButton.titleLabel.font = [UIFont ows_mediumFontWithSize:14.f]; [header addSubview:backButton]; - [backButton autoPinLeadingToSuperviewWithMargin:10.f]; + [backButton autoPinLeadingToSuperviewMarginWithInset:10.f]; [backButton autoAlignAxis:ALAxisHorizontal toSameAxisOfView:titleLabel]; [backButton addTarget:self action:@selector(backButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; @@ -183,7 +183,7 @@ NS_ASSUME_NONNULL_BEGIN [_submitCodeSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize]; [_submitCodeSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize]; [_submitCodeSpinner autoVCenterInSuperview]; - [_submitCodeSpinner autoPinTrailingToSuperviewWithMargin:kSpinnerSpacing]; + [_submitCodeSpinner autoPinTrailingToSuperviewMarginWithInset:kSpinnerSpacing]; _sendCodeViaSMSAgainButton = [UIButton buttonWithType:UIButtonTypeCustom]; _sendCodeViaSMSAgainButton.backgroundColor = [UIColor whiteColor]; @@ -206,7 +206,7 @@ NS_ASSUME_NONNULL_BEGIN [_requestCodeAgainSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize]; [_requestCodeAgainSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize]; [_requestCodeAgainSpinner autoVCenterInSuperview]; - [_requestCodeAgainSpinner autoPinTrailingToSuperviewWithMargin:kSpinnerSpacing]; + [_requestCodeAgainSpinner autoPinTrailingToSuperviewMarginWithInset:kSpinnerSpacing]; _sendCodeViaVoiceButton = [UIButton buttonWithType:UIButtonTypeCustom]; _sendCodeViaVoiceButton.backgroundColor = [UIColor whiteColor]; @@ -230,7 +230,7 @@ NS_ASSUME_NONNULL_BEGIN [_requestCallSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize]; [_requestCallSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize]; [_requestCallSpinner autoVCenterInSuperview]; - [_requestCallSpinner autoPinTrailingToSuperviewWithMargin:kSpinnerSpacing]; + [_requestCallSpinner autoPinTrailingToSuperviewMarginWithInset:kSpinnerSpacing]; } - (NSString *)phoneNumberText diff --git a/Signal/src/ViewControllers/Registration/RegistrationViewController.m b/Signal/src/ViewControllers/Registration/RegistrationViewController.m index 5ba1ee687..6bde5e7e5 100644 --- a/Signal/src/ViewControllers/Registration/RegistrationViewController.m +++ b/Signal/src/ViewControllers/Registration/RegistrationViewController.m @@ -123,7 +123,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi // Country UIView *countryRow = [UIView containerView]; [contentView addSubview:countryRow]; - [countryRow autoPinLeadingAndTrailingToSuperview]; + [countryRow autoPinLeadingAndTrailingToSuperviewMargin]; [countryRow autoPinEdgeToSuperviewEdge:ALEdgeTop]; [countryRow autoSetDimension:ALDimensionHeight toSize:kRowHeight]; [countryRow @@ -137,7 +137,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi countryNameLabel.font = [UIFont ows_mediumFontWithSize:fontSizePoints]; [countryRow addSubview:countryNameLabel]; [countryNameLabel autoVCenterInSuperview]; - [countryNameLabel autoPinLeadingToSuperview]; + [countryNameLabel autoPinLeadingToSuperviewMargin]; UILabel *countryCodeLabel = [UILabel new]; self.countryCodeLabel = countryCodeLabel; @@ -145,7 +145,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi countryCodeLabel.font = [UIFont ows_mediumFontWithSize:fontSizePoints + 2.f]; [countryRow addSubview:countryCodeLabel]; [countryCodeLabel autoVCenterInSuperview]; - [countryCodeLabel autoPinTrailingToSuperview]; + [countryCodeLabel autoPinTrailingToSuperviewMargin]; UIView *separatorView1 = [UIView new]; separatorView1.backgroundColor = [UIColor colorWithWhite:0.75f alpha:1.f]; @@ -157,7 +157,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi // Phone Number UIView *phoneNumberRow = [UIView containerView]; [contentView addSubview:phoneNumberRow]; - [phoneNumberRow autoPinLeadingAndTrailingToSuperview]; + [phoneNumberRow autoPinLeadingAndTrailingToSuperviewMargin]; [phoneNumberRow autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:separatorView1]; [phoneNumberRow autoSetDimension:ALDimensionHeight toSize:kRowHeight]; @@ -168,7 +168,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi phoneNumberLabel.font = [UIFont ows_mediumFontWithSize:fontSizePoints]; [phoneNumberRow addSubview:phoneNumberLabel]; [phoneNumberLabel autoVCenterInSuperview]; - [phoneNumberLabel autoPinLeadingToSuperview]; + [phoneNumberLabel autoPinLeadingToSuperviewMargin]; UITextField *phoneNumberTextField = [UITextField new]; phoneNumberTextField.textAlignment = NSTextAlignmentRight; @@ -181,14 +181,14 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi phoneNumberTextField.font = [UIFont ows_mediumFontWithSize:fontSizePoints + 2]; [phoneNumberRow addSubview:phoneNumberTextField]; [phoneNumberTextField autoVCenterInSuperview]; - [phoneNumberTextField autoPinTrailingToSuperview]; + [phoneNumberTextField autoPinTrailingToSuperviewMargin]; UILabel *examplePhoneNumberLabel = [UILabel new]; self.examplePhoneNumberLabel = examplePhoneNumberLabel; examplePhoneNumberLabel.font = [UIFont ows_regularFontWithSize:fontSizePoints - 2.f]; examplePhoneNumberLabel.textColor = [UIColor colorWithWhite:0.5f alpha:1.f]; [contentView addSubview:examplePhoneNumberLabel]; - [examplePhoneNumberLabel autoPinTrailingToSuperview]; + [examplePhoneNumberLabel autoPinTrailingToSuperviewMargin]; [examplePhoneNumberLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:phoneNumberTextField @@ -216,7 +216,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi selector:@selector(sendCodeAction)]; self.activateButton = activateButton; [contentView addSubview:activateButton]; - [activateButton autoPinLeadingAndTrailingToSuperview]; + [activateButton autoPinLeadingAndTrailingToSuperviewMargin]; [activateButton autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:separatorView2 withOffset:15]; [activateButton autoSetDimension:ALDimensionHeight toSize:kActivateButtonHeight]; @@ -227,7 +227,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi [spinnerView autoVCenterInSuperview]; [spinnerView autoSetDimension:ALDimensionWidth toSize:20.f]; [spinnerView autoSetDimension:ALDimensionHeight toSize:20.f]; - [spinnerView autoPinTrailingToSuperviewWithMargin:20.f]; + [spinnerView autoPinTrailingToSuperviewMarginWithInset:20.f]; [spinnerView stopAnimating]; } diff --git a/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m b/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m index 7f73c52df..8981be3ce 100644 --- a/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m +++ b/Signal/src/ViewControllers/ThreadSettings/OWSConversationSettingsViewController.m @@ -350,14 +350,14 @@ NS_ASSUME_NONNULL_BEGIN UIView *topView = [UIView containerView]; [cell.contentView addSubview:topView]; - [topView autoPinLeadingAndTrailingToSuperview]; + [topView autoPinLeadingAndTrailingToSuperviewMargin]; [topView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight]; UIImageView *iconView = [strongSelf viewForIconWithName:@"ic_timer"]; [topView addSubview:iconView]; [iconView autoVCenterInSuperview]; - [iconView autoPinLeadingToSuperview]; + [iconView autoPinLeadingToSuperviewMargin]; UILabel *rowLabel = [UILabel new]; rowLabel.text = NSLocalizedString(@"DISAPPEARING_MESSAGES", @"table cell label in conversation settings"); @@ -366,7 +366,7 @@ NS_ASSUME_NONNULL_BEGIN rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; [topView addSubview:rowLabel]; [rowLabel autoVCenterInSuperview]; - [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing]; + [rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing]; UISwitch *switchView = [UISwitch new]; switchView.on = strongSelf.disappearingMessagesConfiguration.isEnabled; @@ -375,8 +375,8 @@ NS_ASSUME_NONNULL_BEGIN forControlEvents:UIControlEventValueChanged]; [topView addSubview:switchView]; [switchView autoVCenterInSuperview]; - [switchView autoPinLeadingToTrailingOfView:rowLabel margin:weakSelf.iconSpacing]; - [switchView autoPinTrailingToSuperview]; + [switchView autoPinLeadingToTrailingEdgeOfView:rowLabel offset:weakSelf.iconSpacing]; + [switchView autoPinTrailingToSuperviewMargin]; UILabel *subtitleLabel = [UILabel new]; subtitleLabel.text @@ -388,7 +388,7 @@ NS_ASSUME_NONNULL_BEGIN [cell.contentView addSubview:subtitleLabel]; [subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView]; [subtitleLabel autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel]; - [subtitleLabel autoPinTrailingToSuperview]; + [subtitleLabel autoPinTrailingToSuperviewMargin]; return cell; } @@ -409,14 +409,14 @@ NS_ASSUME_NONNULL_BEGIN UIView *topView = [UIView containerView]; [cell.contentView addSubview:topView]; - [topView autoPinLeadingAndTrailingToSuperview]; + [topView autoPinLeadingAndTrailingToSuperviewMargin]; [topView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight]; UIImageView *iconView = [strongSelf viewForIconWithName:@"ic_timer"]; [topView addSubview:iconView]; [iconView autoVCenterInSuperview]; - [iconView autoPinLeadingToSuperview]; + [iconView autoPinLeadingToSuperviewMargin]; UILabel *rowLabel = strongSelf.disappearingMessagesDurationLabel; [strongSelf updateDisappearingMessagesDurationLabel]; @@ -425,7 +425,7 @@ NS_ASSUME_NONNULL_BEGIN rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; [topView addSubview:rowLabel]; [rowLabel autoVCenterInSuperview]; - [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing]; + [rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing]; UISlider *slider = [UISlider new]; slider.maximumValue = (float)(strongSelf.disappearingMessagesDurations.count - 1); @@ -438,7 +438,7 @@ NS_ASSUME_NONNULL_BEGIN [cell.contentView addSubview:slider]; [slider autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView]; [slider autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel]; - [slider autoPinTrailingToSuperview]; + [slider autoPinTrailingToSuperviewMargin]; return cell; } @@ -502,7 +502,7 @@ NS_ASSUME_NONNULL_BEGIN UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_notification_sound"]; [cell.contentView addSubview:iconView]; [iconView autoVCenterInSuperview]; - [iconView autoPinLeadingToSuperview]; + [iconView autoPinLeadingToSuperviewMargin]; UILabel *rowLabel = [UILabel new]; rowLabel.text = NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND", @@ -512,7 +512,7 @@ NS_ASSUME_NONNULL_BEGIN rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; [cell.contentView addSubview:rowLabel]; [rowLabel autoVCenterInSuperview]; - [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing]; + [rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing]; OWSSound sound = [OWSSounds notificationSoundForThread:self.thread]; cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound]; @@ -536,7 +536,7 @@ NS_ASSUME_NONNULL_BEGIN UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_mute_thread"]; [cell.contentView addSubview:iconView]; [iconView autoVCenterInSuperview]; - [iconView autoPinLeadingToSuperview]; + [iconView autoPinLeadingToSuperviewMargin]; UILabel *rowLabel = [UILabel new]; rowLabel.text = NSLocalizedString( @@ -546,7 +546,7 @@ NS_ASSUME_NONNULL_BEGIN rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; [cell.contentView addSubview:rowLabel]; [rowLabel autoVCenterInSuperview]; - [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing]; + [rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing]; NSString *muteStatus = NSLocalizedString( @"CONVERSATION_SETTINGS_MUTE_NOT_MUTED", @"Indicates that the current thread is not muted."); @@ -635,7 +635,7 @@ NS_ASSUME_NONNULL_BEGIN UIImageView *iconView = [self viewForIconWithName:iconName]; [cell.contentView addSubview:iconView]; [iconView autoVCenterInSuperview]; - [iconView autoPinLeadingToSuperview]; + [iconView autoPinLeadingToSuperviewMargin]; UILabel *rowLabel = [UILabel new]; rowLabel.text = name; @@ -644,8 +644,8 @@ NS_ASSUME_NONNULL_BEGIN rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; [cell.contentView addSubview:rowLabel]; [rowLabel autoVCenterInSuperview]; - [rowLabel autoPinLeadingToTrailingOfView:iconView margin:self.iconSpacing]; - [rowLabel autoPinTrailingToSuperview]; + [rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:self.iconSpacing]; + [rowLabel autoPinTrailingToSuperviewMargin]; return cell; } @@ -681,15 +681,15 @@ NS_ASSUME_NONNULL_BEGIN _avatarView = avatarView; [threadInfoView addSubview:avatarView]; [avatarView autoVCenterInSuperview]; - [avatarView autoPinLeadingToSuperview]; + [avatarView autoPinLeadingToSuperviewMargin]; [avatarView autoSetDimension:ALDimensionWidth toSize:kAvatarSize]; [avatarView autoSetDimension:ALDimensionHeight toSize:kAvatarSize]; UIView *threadNameView = [UIView containerView]; [threadInfoView addSubview:threadNameView]; [threadNameView autoVCenterInSuperview]; - [threadNameView autoPinTrailingToSuperview]; - [threadNameView autoPinLeadingToTrailingOfView:avatarView margin:16.f]; + [threadNameView autoPinTrailingToSuperviewMargin]; + [threadNameView autoPinLeadingToTrailingEdgeOfView:avatarView offset:16.f]; UILabel *threadTitleLabel = [UILabel new]; threadTitleLabel.text = self.threadName; @@ -712,7 +712,7 @@ NS_ASSUME_NONNULL_BEGIN subtitleLabel.lineBreakMode = NSLineBreakByTruncatingTail; [threadNameView addSubview:subtitleLabel]; [subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:lastTitleView]; - [subtitleLabel autoPinLeadingToSuperview]; + [subtitleLabel autoPinLeadingToSuperviewMargin]; lastTitleView = subtitleLabel; }; diff --git a/Signal/src/ViewControllers/ThreadSettings/UpdateGroupViewController.m b/Signal/src/ViewControllers/ThreadSettings/UpdateGroupViewController.m index c9c915472..0fedeb73c 100644 --- a/Signal/src/ViewControllers/ThreadSettings/UpdateGroupViewController.m +++ b/Signal/src/ViewControllers/ThreadSettings/UpdateGroupViewController.m @@ -189,7 +189,7 @@ NS_ASSUME_NONNULL_BEGIN [threadInfoView addSubview:avatarView]; [avatarView autoVCenterInSuperview]; - [avatarView autoPinLeadingToSuperview]; + [avatarView autoPinLeadingToSuperviewMargin]; [avatarView autoSetDimension:ALDimensionWidth toSize:kAvatarSize]; [avatarView autoSetDimension:ALDimensionHeight toSize:kAvatarSize]; _groupAvatar = self.thread.groupModel.groupImage; @@ -208,8 +208,8 @@ NS_ASSUME_NONNULL_BEGIN forControlEvents:UIControlEventEditingChanged]; [threadInfoView addSubview:groupNameTextField]; [groupNameTextField autoVCenterInSuperview]; - [groupNameTextField autoPinTrailingToSuperview]; - [groupNameTextField autoPinLeadingToTrailingOfView:avatarView margin:16.f]; + [groupNameTextField autoPinTrailingToSuperviewMargin]; + [groupNameTextField autoPinLeadingToTrailingEdgeOfView:avatarView offset:16.f]; [avatarView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarTouched:)]]; diff --git a/Signal/src/util/OWSScreenLockUI.m b/Signal/src/util/OWSScreenLockUI.m index d8ef8c844..b4579c6ae 100644 --- a/Signal/src/util/OWSScreenLockUI.m +++ b/Signal/src/util/OWSScreenLockUI.m @@ -396,10 +396,10 @@ NS_ASSUME_NONNULL_BEGIN [edgesView addSubview:button]; [button autoSetDimension:ALDimensionHeight toSize:kButtonHeight]; - [button autoPinLeadingToSuperviewWithMargin:50.f]; - [button autoPinTrailingToSuperviewWithMargin:50.f]; + [button autoPinLeadingToSuperviewMarginWithInset:50.f]; + [button autoPinTrailingToSuperviewMarginWithInset:50.f]; const CGFloat kVMargin = 65.f; - [button autoPinBottomToSuperviewWithMargin:kVMargin]; + [button autoPinBottomToSuperviewMarginWithInset:kVMargin]; window.rootViewController = viewController; diff --git a/Signal/src/views/GroupTableViewCell.swift b/Signal/src/views/GroupTableViewCell.swift index b860dfaad..d71547fdd 100644 --- a/Signal/src/views/GroupTableViewCell.swift +++ b/Signal/src/views/GroupTableViewCell.swift @@ -37,13 +37,13 @@ import SignalServiceKit subtitleLabel.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets.zero, excludingEdge: .top) subtitleLabel.autoPinEdge(.top, to: .bottom, of: nameLabel) - avatarView.autoPinLeadingToSuperview() + avatarView.autoPinLeadingToSuperviewMargin() avatarView.autoVCenterInSuperview() avatarView.autoSetDimension(.width, toSize: CGFloat(kContactTableViewCellAvatarSize)) avatarView.autoPinToSquareAspectRatio() textContainer.autoPinEdge(.leading, to: .trailing, of: avatarView, withOffset: kContactTableViewCellAvatarTextMargin) - textContainer.autoPinTrailingToSuperview() + textContainer.autoPinTrailingToSuperviewMargin() textContainer.autoVCenterInSuperview() } diff --git a/Signal/src/views/PinEntryView.m b/Signal/src/views/PinEntryView.m index 877baa431..1e8cb6d97 100644 --- a/Signal/src/views/PinEntryView.m +++ b/Signal/src/views/PinEntryView.m @@ -137,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN UILabel *instructionsLabel = [self createLabelWithText:nil]; self.instructionsLabel = instructionsLabel; - [instructionsLabel autoPinTopToSuperviewWithMargin:kVSpacing]; + [instructionsLabel autoPinTopToSuperviewMarginWithInset:kVSpacing]; [instructionsLabel autoPinWidthToSuperview]; UILabel *createForgotLink = [self createForgotLink]; diff --git a/SignalMessaging/Views/ContactTableViewCell.m b/SignalMessaging/Views/ContactTableViewCell.m index 9cf535f6c..37d3d36eb 100644 --- a/SignalMessaging/Views/ContactTableViewCell.m +++ b/SignalMessaging/Views/ContactTableViewCell.m @@ -93,7 +93,7 @@ const CGFloat kContactTableViewCellAvatarTextMargin = 12; [_nameContainerView addSubview:self.subtitle]; [_avatarView autoVCenterInSuperview]; - [_avatarView autoPinLeadingToSuperview]; + [_avatarView autoPinLeadingToSuperviewMargin]; [_avatarView autoSetDimension:ALDimensionWidth toSize:kContactTableViewCellAvatarSize]; [_avatarView autoSetDimension:ALDimensionHeight toSize:kContactTableViewCellAvatarSize]; @@ -110,8 +110,8 @@ const CGFloat kContactTableViewCellAvatarTextMargin = 12; [_subtitle autoPinEdgeToSuperviewEdge:ALEdgeBottom]; [_nameContainerView autoVCenterInSuperview]; - [_nameContainerView autoPinLeadingToTrailingOfView:_avatarView margin:kContactTableViewCellAvatarTextMargin]; - [_nameContainerView autoPinTrailingToSuperview]; + [_nameContainerView autoPinLeadingToTrailingEdgeOfView:_avatarView offset:kContactTableViewCellAvatarTextMargin]; + [_nameContainerView autoPinTrailingToSuperviewMargin]; // Force layout, since imageView isn't being initally rendered on App Store optimized build. [self layoutSubviews]; diff --git a/SignalMessaging/attachments/MessageApprovalViewController.swift b/SignalMessaging/attachments/MessageApprovalViewController.swift index cf63f9934..3ae1dab5a 100644 --- a/SignalMessaging/attachments/MessageApprovalViewController.swift +++ b/SignalMessaging/attachments/MessageApprovalViewController.swift @@ -121,14 +121,14 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat topBorder.backgroundColor = borderColor recipientRow.addSubview(topBorder) topBorder.autoPinWidthToSuperview() - topBorder.autoPinTopToSuperview() + topBorder.autoPinTopToSuperviewMargin() topBorder.autoSetDimension(.height, toSize: borderThickness) let bottomBorder = UIView.container() bottomBorder.backgroundColor = borderColor recipientRow.addSubview(bottomBorder) bottomBorder.autoPinWidthToSuperview() - bottomBorder.autoPinBottomToSuperview() + bottomBorder.autoPinBottomToSuperviewMargin() bottomBorder.autoSetDimension(.height, toSize: borderThickness) let font = UIFont.ows_regularFont(withSize:ScaleFromIPhone5To7Plus(14.0, 18.0)) @@ -150,16 +150,16 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat nameLabel.lineBreakMode = .byTruncatingTail recipientRow.addSubview(nameLabel) - toLabel.autoPinLeadingToSuperview(withMargin: hMargin) + toLabel.autoPinLeadingToSuperviewMargin(withInset: hMargin) toLabel.setContentHuggingHorizontalHigh() toLabel.setCompressionResistanceHorizontalHigh() toLabel.autoAlignAxis(.horizontal, toSameAxisOf: nameLabel) - - nameLabel.autoPinLeading(toTrailingOf: toLabel, margin:hSpacing) - nameLabel.autoPinTrailingToSuperview(withMargin: hMargin) + + nameLabel.autoPinLeading(toTrailingEdgeOf: toLabel, offset: hSpacing) + nameLabel.autoPinTrailingToSuperviewMargin(withInset: hMargin) nameLabel.setContentHuggingHorizontalLow() nameLabel.setCompressionResistanceHorizontalLow() - nameLabel.autoPinTopToSuperview(withMargin: vMargin) + nameLabel.autoPinTopToSuperviewMargin(withInset: vMargin) if let groupThread = self.thread as? TSGroupThread { let groupName = (groupThread.name().count > 0 @@ -167,7 +167,7 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat : MessageStrings.newGroupDefaultTitle) nameLabel.text = groupName - nameLabel.autoPinBottomToSuperview(withMargin: vMargin) + nameLabel.autoPinBottomToSuperviewMargin(withInset: vMargin) return recipientRow } @@ -188,13 +188,13 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat profileNameLabel.lineBreakMode = .byTruncatingTail recipientRow.addSubview(profileNameLabel) profileNameLabel.autoPinEdge(.top, to: .bottom, of: nameLabel, withOffset: vSpacing) - profileNameLabel.autoPinLeading(toTrailingOf: toLabel, margin:hSpacing) - profileNameLabel.autoPinTrailingToSuperview(withMargin: hMargin) + profileNameLabel.autoPinLeading(toTrailingEdgeOf: toLabel, offset: hSpacing) + profileNameLabel.autoPinTrailingToSuperviewMargin(withInset: hMargin) profileNameLabel.setContentHuggingHorizontalLow() profileNameLabel.setCompressionResistanceHorizontalLow() - profileNameLabel.autoPinBottomToSuperview(withMargin: vMargin) + profileNameLabel.autoPinBottomToSuperviewMargin(withInset: vMargin) } else { - nameLabel.autoPinBottomToSuperview(withMargin: vMargin) + nameLabel.autoPinBottomToSuperviewMargin(withInset: vMargin) } return recipientRow diff --git a/SignalMessaging/categories/UIView+OWS.h b/SignalMessaging/categories/UIView+OWS.h index 095624c38..2b4b114c8 100644 --- a/SignalMessaging/categories/UIView+OWS.h +++ b/SignalMessaging/categories/UIView+OWS.h @@ -78,25 +78,25 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value); // // NOTE: the margin values are inverted in RTL layouts. - (BOOL)isRTL; -- (NSArray *)autoPinLeadingAndTrailingToSuperview; -- (NSLayoutConstraint *)autoPinLeadingToSuperview; -- (NSLayoutConstraint *)autoPinLeadingToSuperviewWithMargin:(CGFloat)margin; -- (NSLayoutConstraint *)autoPinTrailingToSuperview; -- (NSLayoutConstraint *)autoPinTrailingToSuperviewWithMargin:(CGFloat)margin; - -- (NSLayoutConstraint *)autoPinTopToSuperview; -- (NSLayoutConstraint *)autoPinTopToSuperviewWithMargin:(CGFloat)margin; -- (NSLayoutConstraint *)autoPinBottomToSuperview; -- (NSLayoutConstraint *)autoPinBottomToSuperviewWithMargin:(CGFloat)margin; - -- (NSLayoutConstraint *)autoPinLeadingToTrailingOfView:(UIView *)view; -- (NSLayoutConstraint *)autoPinLeadingToTrailingOfView:(UIView *)view margin:(CGFloat)margin; -- (NSLayoutConstraint *)autoPinTrailingToLeadingOfView:(UIView *)view; -- (NSLayoutConstraint *)autoPinTrailingToLeadingOfView:(UIView *)view margin:(CGFloat)margin; -- (NSLayoutConstraint *)autoPinLeadingToView:(UIView *)view; -- (NSLayoutConstraint *)autoPinLeadingToView:(UIView *)view margin:(CGFloat)margin; -- (NSLayoutConstraint *)autoPinTrailingToView:(UIView *)view; -- (NSLayoutConstraint *)autoPinTrailingToView:(UIView *)view margin:(CGFloat)margin; +- (NSArray *)autoPinLeadingAndTrailingToSuperviewMargin; +- (NSLayoutConstraint *)autoPinLeadingToSuperviewMargin; +- (NSLayoutConstraint *)autoPinLeadingToSuperviewMarginWithInset:(CGFloat)margin; +- (NSLayoutConstraint *)autoPinTrailingToSuperviewMargin; +- (NSLayoutConstraint *)autoPinTrailingToSuperviewMarginWithInset:(CGFloat)margin; + +- (NSLayoutConstraint *)autoPinTopToSuperviewMargin; +- (NSLayoutConstraint *)autoPinTopToSuperviewMarginWithInset:(CGFloat)margin; +- (NSLayoutConstraint *)autoPinBottomToSuperviewMargin; +- (NSLayoutConstraint *)autoPinBottomToSuperviewMarginWithInset:(CGFloat)margin; + +- (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view; +- (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view offset:(CGFloat)margin; +- (NSLayoutConstraint *)autoPinTrailingToLeadingEdgeOfView:(UIView *)view; +- (NSLayoutConstraint *)autoPinTrailingToLeadingEdgeOfView:(UIView *)view offset:(CGFloat)margin; +- (NSLayoutConstraint *)autoPinLeadingToEdgeOfView:(UIView *)view; +- (NSLayoutConstraint *)autoPinLeadingToEdgeOfView:(UIView *)view offset:(CGFloat)margin; +- (NSLayoutConstraint *)autoPinTrailingToEdgeOfView:(UIView *)view; +- (NSLayoutConstraint *)autoPinTrailingToEdgeOfView:(UIView *)view offset:(CGFloat)margin; // Return Right on LTR and Left on RTL. - (NSTextAlignment)textAlignmentUnnatural; // Leading and trailing anchors honor layout margins. diff --git a/SignalMessaging/categories/UIView+OWS.m b/SignalMessaging/categories/UIView+OWS.m index 2297497ff..01d16defc 100644 --- a/SignalMessaging/categories/UIView+OWS.m +++ b/SignalMessaging/categories/UIView+OWS.m @@ -52,11 +52,11 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) return result; } -- (NSArray *)autoPinLeadingAndTrailingToSuperview +- (NSArray *)autoPinLeadingAndTrailingToSuperviewMargin { NSArray *result = @[ - [self autoPinLeadingToSuperview], - [self autoPinTrailingToSuperview], + [self autoPinLeadingToSuperviewMargin], + [self autoPinTrailingToSuperviewMargin], ]; return result; } @@ -257,128 +257,128 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) == UIUserInterfaceLayoutDirectionRightToLeft); } -- (NSLayoutConstraint *)autoPinLeadingToSuperview +- (NSLayoutConstraint *)autoPinLeadingToSuperviewMargin { - return [self autoPinLeadingToSuperviewWithMargin:0]; + return [self autoPinLeadingToSuperviewMarginWithInset:0]; } -- (NSLayoutConstraint *)autoPinLeadingToSuperviewWithMargin:(CGFloat)margin +- (NSLayoutConstraint *)autoPinLeadingToSuperviewMarginWithInset:(CGFloat)inset { self.translatesAutoresizingMaskIntoConstraints = NO; NSLayoutConstraint *constraint = - [self.leadingAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.leadingAnchor constant:margin]; + [self.leadingAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.leadingAnchor constant:inset]; constraint.active = YES; return constraint; } -- (NSLayoutConstraint *)autoPinTrailingToSuperview +- (NSLayoutConstraint *)autoPinTrailingToSuperviewMargin { - return [self autoPinTrailingToSuperviewWithMargin:0]; + return [self autoPinTrailingToSuperviewMarginWithInset:0]; } -- (NSLayoutConstraint *)autoPinTrailingToSuperviewWithMargin:(CGFloat)margin +- (NSLayoutConstraint *)autoPinTrailingToSuperviewMarginWithInset:(CGFloat)inset { self.translatesAutoresizingMaskIntoConstraints = NO; NSLayoutConstraint *constraint = - [self.trailingAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.trailingAnchor constant:-margin]; + [self.trailingAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.trailingAnchor constant:-inset]; constraint.active = YES; return constraint; } -- (NSLayoutConstraint *)autoPinBottomToSuperview +- (NSLayoutConstraint *)autoPinBottomToSuperviewMargin { - return [self autoPinBottomToSuperviewWithMargin:0.f]; + return [self autoPinBottomToSuperviewMarginWithInset:0.f]; } -- (NSLayoutConstraint *)autoPinBottomToSuperviewWithMargin:(CGFloat)margin +- (NSLayoutConstraint *)autoPinBottomToSuperviewMarginWithInset:(CGFloat)inset { self.translatesAutoresizingMaskIntoConstraints = NO; NSLayoutConstraint *constraint = - [self.bottomAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.bottomAnchor constant:-margin]; + [self.bottomAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.bottomAnchor constant:-inset]; constraint.active = YES; return constraint; } -- (NSLayoutConstraint *)autoPinTopToSuperview +- (NSLayoutConstraint *)autoPinTopToSuperviewMargin { - return [self autoPinTopToSuperviewWithMargin:0.f]; + return [self autoPinTopToSuperviewMarginWithInset:0.f]; } -- (NSLayoutConstraint *)autoPinTopToSuperviewWithMargin:(CGFloat)margin +- (NSLayoutConstraint *)autoPinTopToSuperviewMarginWithInset:(CGFloat)inset { self.translatesAutoresizingMaskIntoConstraints = NO; NSLayoutConstraint *constraint = - [self.topAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.topAnchor constant:margin]; + [self.topAnchor constraintEqualToAnchor:self.superview.layoutMarginsGuide.topAnchor constant:inset]; constraint.active = YES; return constraint; } -- (NSLayoutConstraint *)autoPinLeadingToTrailingOfView:(UIView *)view +- (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view { OWSAssert(view); - return [self autoPinLeadingToTrailingOfView:view margin:0]; + return [self autoPinLeadingToTrailingEdgeOfView:view offset:0]; } -- (NSLayoutConstraint *)autoPinLeadingToTrailingOfView:(UIView *)view margin:(CGFloat)margin +- (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view offset:(CGFloat)offset { OWSAssert(view); self.translatesAutoresizingMaskIntoConstraints = NO; - NSLayoutConstraint *constraint = [self.leadingAnchor constraintEqualToAnchor:view.trailingAnchor constant:margin]; + NSLayoutConstraint *constraint = [self.leadingAnchor constraintEqualToAnchor:view.trailingAnchor constant:offset]; constraint.active = YES; return constraint; } -- (NSLayoutConstraint *)autoPinTrailingToLeadingOfView:(UIView *)view +- (NSLayoutConstraint *)autoPinTrailingToLeadingEdgeOfView:(UIView *)view { OWSAssert(view); - return [self autoPinTrailingToLeadingOfView:view margin:0]; + return [self autoPinTrailingToLeadingEdgeOfView:view offset:0]; } -- (NSLayoutConstraint *)autoPinTrailingToLeadingOfView:(UIView *)view margin:(CGFloat)margin +- (NSLayoutConstraint *)autoPinTrailingToLeadingEdgeOfView:(UIView *)view offset:(CGFloat)offset { OWSAssert(view); self.translatesAutoresizingMaskIntoConstraints = NO; - NSLayoutConstraint *constraint = [self.trailingAnchor constraintEqualToAnchor:view.leadingAnchor constant:-margin]; + NSLayoutConstraint *constraint = [self.trailingAnchor constraintEqualToAnchor:view.leadingAnchor constant:-offset]; constraint.active = YES; return constraint; } -- (NSLayoutConstraint *)autoPinLeadingToView:(UIView *)view +- (NSLayoutConstraint *)autoPinLeadingToEdgeOfView:(UIView *)view { OWSAssert(view); - return [self autoPinLeadingToView:view margin:0]; + return [self autoPinLeadingToEdgeOfView:view offset:0]; } -- (NSLayoutConstraint *)autoPinLeadingToView:(UIView *)view margin:(CGFloat)margin +- (NSLayoutConstraint *)autoPinLeadingToEdgeOfView:(UIView *)view offset:(CGFloat)offset { OWSAssert(view); self.translatesAutoresizingMaskIntoConstraints = NO; - NSLayoutConstraint *constraint = [self.leadingAnchor constraintEqualToAnchor:view.leadingAnchor constant:margin]; + NSLayoutConstraint *constraint = [self.leadingAnchor constraintEqualToAnchor:view.leadingAnchor constant:offset]; constraint.active = YES; return constraint; } -- (NSLayoutConstraint *)autoPinTrailingToView:(UIView *)view +- (NSLayoutConstraint *)autoPinTrailingToEdgeOfView:(UIView *)view { OWSAssert(view); - return [self autoPinTrailingToView:view margin:0]; + return [self autoPinTrailingToEdgeOfView:view offset:0]; } -- (NSLayoutConstraint *)autoPinTrailingToView:(UIView *)view margin:(CGFloat)margin +- (NSLayoutConstraint *)autoPinTrailingToEdgeOfView:(UIView *)view offset:(CGFloat)margin { OWSAssert(view); diff --git a/SignalMessaging/contacts/SelectRecipientViewController.m b/SignalMessaging/contacts/SelectRecipientViewController.m index 3f6f4c7c0..257a04b85 100644 --- a/SignalMessaging/contacts/SelectRecipientViewController.m +++ b/SignalMessaging/contacts/SelectRecipientViewController.m @@ -194,7 +194,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien { UIView *row = [UIView containerView]; [superview addSubview:row]; - [row autoPinLeadingAndTrailingToSuperview]; + [row autoPinLeadingAndTrailingToSuperviewMargin]; if (previousRow) { [row autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:previousRow withOffset:0]; } else { @@ -457,11 +457,11 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien UILabel *countryCodeLabel = strongSelf.countryCodeLabel; [countryRow addSubview:countryCodeLabel]; - [countryCodeLabel autoPinLeadingToSuperview]; + [countryCodeLabel autoPinLeadingToSuperviewMargin]; [countryCodeLabel autoVCenterInSuperview]; [countryRow addSubview:strongSelf.countryCodeButton]; - [strongSelf.countryCodeButton autoPinTrailingToSuperview]; + [strongSelf.countryCodeButton autoPinTrailingToSuperviewMargin]; [strongSelf.countryCodeButton autoVCenterInSuperview]; // Phone Number Row @@ -473,12 +473,12 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien UILabel *phoneNumberLabel = strongSelf.phoneNumberLabel; [phoneNumberRow addSubview:phoneNumberLabel]; - [phoneNumberLabel autoPinLeadingToSuperview]; + [phoneNumberLabel autoPinLeadingToSuperviewMargin]; [phoneNumberLabel autoVCenterInSuperview]; [phoneNumberRow addSubview:strongSelf.phoneNumberTextField]; - [strongSelf.phoneNumberTextField autoPinLeadingToTrailingOfView:phoneNumberLabel margin:10.f]; - [strongSelf.phoneNumberTextField autoPinTrailingToSuperview]; + [strongSelf.phoneNumberTextField autoPinLeadingToTrailingEdgeOfView:phoneNumberLabel offset:10.f]; + [strongSelf.phoneNumberTextField autoPinTrailingToSuperviewMargin]; [strongSelf.phoneNumberTextField autoVCenterInSuperview]; // Example row. @@ -487,7 +487,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien superview:cell.contentView]; [examplePhoneNumberRow addSubview:strongSelf.examplePhoneNumberLabel]; [strongSelf.examplePhoneNumberLabel autoVCenterInSuperview]; - [strongSelf.examplePhoneNumberLabel autoPinTrailingToSuperview]; + [strongSelf.examplePhoneNumberLabel autoPinTrailingToSuperviewMargin]; // Phone Number Button Row UIView *buttonRow = [strongSelf createRowWithHeight:kButtonRowHeight @@ -495,7 +495,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien superview:cell.contentView]; [buttonRow addSubview:strongSelf.phoneNumberButton]; [strongSelf.phoneNumberButton autoVCenterInSuperview]; - [strongSelf.phoneNumberButton autoPinTrailingToSuperview]; + [strongSelf.phoneNumberButton autoPinTrailingToSuperviewMargin]; [buttonRow autoPinEdgeToSuperviewEdge:ALEdgeBottom];