clarify different methods

These method names were too similar to existing methods in PureLayout, which
have slightly different behavior.

ows_autoPinToSuperviewEdges uses left/right, whereas PureLayouts uses
leading/trailing

ows_autoPinToSuperviewMargins uses our own constraint adding logic, which
behaves differently in some cases.
pull/1/head
Michael Kirk 7 years ago
parent 9df6b4bb78
commit 8da47b64d9

@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
layer.opacity = 0.5f; layer.opacity = 0.5f;
}]; }];
[self.view addSubview:maskingView]; [self.view addSubview:maskingView];
[maskingView autoPinToSuperviewEdges]; [maskingView ows_autoPinToSuperviewEdges];
} }
- (void)viewWillAppear:(BOOL)animated - (void)viewWillAppear:(BOOL)animated

@ -132,7 +132,7 @@ NS_ASSUME_NONNULL_BEGIN
label.textColor = UIColor.ows_materialBlueColor; label.textColor = UIColor.ows_materialBlueColor;
label.textAlignment = NSTextAlignmentCenter; label.textAlignment = NSTextAlignmentCenter;
[self addSubview:label]; [self addSubview:label];
[label autoPinToSuperviewEdges]; [label ows_autoPinToSuperviewEdges];
[label autoSetDimension:ALDimensionHeight toSize:OWSContactShareButtonsView.buttonHeight]; [label autoSetDimension:ALDimensionHeight toSize:OWSContactShareButtonsView.buttonHeight];
self.userInteractionEnabled = YES; self.userInteractionEnabled = YES;

@ -157,7 +157,7 @@ NS_ASSUME_NONNULL_BEGIN
[hStackView addArrangedSubview:labelsView]; [hStackView addArrangedSubview:labelsView];
[hStackView addArrangedSubview:disclosureImageView]; [hStackView addArrangedSubview:disclosureImageView];
[self addSubview:hStackView]; [self addSubview:hStackView];
[hStackView autoPinToSuperviewEdges]; [hStackView ows_autoPinToSuperviewEdges];
} }
@end @end

@ -363,7 +363,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.viewConstraints addObjectsFromArray:[clipView autoPinToEdgesOfView:proxyView]]; [self.viewConstraints addObjectsFromArray:[clipView autoPinToEdgesOfView:proxyView]];
[clipView addSubview:bodyMediaView]; [clipView addSubview:bodyMediaView];
[self.viewConstraints addObjectsFromArray:[bodyMediaView autoPinToSuperviewEdges]]; [self.viewConstraints addObjectsFromArray:[bodyMediaView ows_autoPinToSuperviewEdges]];
[self.bubbleView addPartnerView:shadowView1]; [self.bubbleView addPartnerView:shadowView1];
[self.bubbleView addPartnerView:shadowView2]; [self.bubbleView addPartnerView:shadowView2];
@ -447,7 +447,7 @@ NS_ASSUME_NONNULL_BEGIN
}]; }];
[gradientView.layer addSublayer:gradientLayer]; [gradientView.layer addSublayer:gradientLayer];
[bodyMediaView addSubview:gradientView]; [bodyMediaView addSubview:gradientView];
[self.viewConstraints addObjectsFromArray:[gradientView autoPinToSuperviewEdges]]; [self.viewConstraints addObjectsFromArray:[gradientView ows_autoPinToSuperviewEdges]];
[self.footerView configureWithConversationViewItem:self.viewItem [self.footerView configureWithConversationViewItem:self.viewItem
isOverlayingMedia:YES isOverlayingMedia:YES
@ -528,7 +528,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.viewConstraints addObjectsFromArray:[clipView autoPinToEdgesOfView:proxyView]]; [self.viewConstraints addObjectsFromArray:[clipView autoPinToEdgesOfView:proxyView]];
[clipView addSubview:buttonsView]; [clipView addSubview:buttonsView];
[self.viewConstraints addObjectsFromArray:[buttonsView autoPinToSuperviewEdges]]; [self.viewConstraints addObjectsFromArray:[buttonsView ows_autoPinToSuperviewEdges]];
[self.bubbleView addPartnerView:shadowView]; [self.bubbleView addPartnerView:shadowView];
[self.bubbleView addPartnerView:clipView]; [self.bubbleView addPartnerView:clipView];
@ -1091,7 +1091,7 @@ NS_ASSUME_NONNULL_BEGIN
[[AttachmentUploadView alloc] initWithAttachment:self.attachmentStream [[AttachmentUploadView alloc] initWithAttachment:self.attachmentStream
attachmentStateCallback:attachmentStateCallback]; attachmentStateCallback:attachmentStateCallback];
[self.bubbleView addSubview:attachmentUploadView]; [self.bubbleView addSubview:attachmentUploadView];
[attachmentUploadView autoPinToSuperviewEdges]; [attachmentUploadView ows_autoPinToSuperviewEdges];
} }
} }
} }

@ -56,7 +56,7 @@ const CGFloat kDisappearingMessageIconSize = 12.f;
{ {
self.imageView = [UIImageView new]; self.imageView = [UIImageView new];
[self addSubview:self.imageView]; [self addSubview:self.imageView];
[self.imageView autoPinToSuperviewEdges]; [self.imageView ows_autoPinToSuperviewEdges];
[self.imageView autoSetDimension:ALDimensionWidth toSize:kDisappearingMessageIconSize]; [self.imageView autoSetDimension:ALDimensionWidth toSize:kDisappearingMessageIconSize];
[self.imageView autoSetDimension:ALDimensionHeight toSize:kDisappearingMessageIconSize]; [self.imageView autoSetDimension:ALDimensionHeight toSize:kDisappearingMessageIconSize];
} }

@ -190,7 +190,7 @@ NS_ASSUME_NONNULL_BEGIN
hStackView.axis = UILayoutConstraintAxisHorizontal; hStackView.axis = UILayoutConstraintAxisHorizontal;
hStackView.spacing = self.hSpacing; hStackView.spacing = self.hSpacing;
[innerBubbleView addSubview:hStackView]; [innerBubbleView addSubview:hStackView];
[hStackView autoPinToSuperviewEdges]; [hStackView ows_autoPinToSuperviewEdges];
UIView *stripeView = [UIView new]; UIView *stripeView = [UIView new];
stripeView.backgroundColor = [self.conversationStyle quotedReplyStripeColorWithIsIncoming:!self.isOutgoing]; stripeView.backgroundColor = [self.conversationStyle quotedReplyStripeColorWithIsIncoming:!self.isOutgoing];

@ -248,7 +248,7 @@ const CGFloat kMaxTextViewHeight = 98;
UIView *wrapper = [UIView containerView]; UIView *wrapper = [UIView containerView];
wrapper.layoutMargins = UIEdgeInsetsMake(self.quotedMessageTopMargin, 0, 0, 0); wrapper.layoutMargins = UIEdgeInsetsMake(self.quotedMessageTopMargin, 0, 0, 0);
[wrapper addSubview:quotedMessagePreview]; [wrapper addSubview:quotedMessagePreview];
[quotedMessagePreview autoPinToSuperviewMargins]; [quotedMessagePreview ows_autoPinToSuperviewMargins];
[self.contentRows insertArrangedSubview:wrapper atIndex:0]; [self.contentRows insertArrangedSubview:wrapper atIndex:0];
@ -386,7 +386,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.voiceMemoContentView = [UIView new]; self.voiceMemoContentView = [UIView new];
[self.voiceMemoUI addSubview:self.voiceMemoContentView]; [self.voiceMemoUI addSubview:self.voiceMemoContentView];
[self.voiceMemoContentView autoPinToSuperviewEdges]; [self.voiceMemoContentView ows_autoPinToSuperviewEdges];
self.recordingLabel = [UILabel new]; self.recordingLabel = [UILabel new];
self.recordingLabel.textColor = [UIColor ows_destructiveRedColor]; self.recordingLabel.textColor = [UIColor ows_destructiveRedColor];

@ -206,7 +206,7 @@ class GifPickerCell: UICollectionViewCell {
let imageView = YYAnimatedImageView() let imageView = YYAnimatedImageView()
self.imageView = imageView self.imageView = imageView
self.contentView.addSubview(imageView) self.contentView.addSubview(imageView)
imageView.autoPinToSuperviewEdges() imageView.ows_autoPinToSuperviewEdges()
} }
guard let imageView = imageView else { guard let imageView = imageView else {
owsFail("\(TAG) missing imageview.") owsFail("\(TAG) missing imageview.")

@ -180,7 +180,7 @@ NS_ASSUME_NONNULL_BEGIN
self.automaticallyAdjustsScrollViewInsets = NO; self.automaticallyAdjustsScrollViewInsets = NO;
} }
[scrollView autoPinToSuperviewEdges]; [scrollView ows_autoPinToSuperviewEdges];
if (self.isAnimated) { if (self.isAnimated) {
if (self.attachmentStream.isValidImage) { if (self.attachmentStream.isValidImage) {

@ -293,7 +293,7 @@ class MenuActionSheetView: UIView, MenuActionViewDelegate {
backgroundColor = UIColor.ows_light10 backgroundColor = UIColor.ows_light10
addSubview(actionStackView) addSubview(actionStackView)
actionStackView.autoPinToSuperviewEdges() actionStackView.ows_autoPinToSuperviewEdges()
self.clipsToBounds = true self.clipsToBounds = true
@ -378,7 +378,7 @@ class MenuActionView: UIButton {
contentRow.isUserInteractionEnabled = false contentRow.isUserInteractionEnabled = false
self.addSubview(contentRow) self.addSubview(contentRow)
contentRow.autoPinToSuperviewMargins() contentRow.ows_autoPinToSuperviewMargins()
contentRow.autoSetDimension(.height, toSize: 56, relation: .greaterThanOrEqual) contentRow.autoSetDimension(.height, toSize: 56, relation: .greaterThanOrEqual)
self.addTarget(self, action: #selector(didPress(sender:)), for: .touchUpInside) self.addTarget(self, action: #selector(didPress(sender:)), for: .touchUpInside)

@ -289,7 +289,7 @@ typedef void (^CustomLayoutBlock)(void);
layer.path = [UIBezierPath bezierPathWithOvalInRect:circle].CGPath; layer.path = [UIBezierPath bezierPathWithOvalInRect:circle].CGPath;
}]; }];
[fingerprintView addSubview:fingerprintCircle]; [fingerprintView addSubview:fingerprintCircle];
[fingerprintCircle autoPinToSuperviewEdges]; [fingerprintCircle ows_autoPinToSuperviewEdges];
UIImageView *fingerprintImageView = [UIImageView new]; UIImageView *fingerprintImageView = [UIImageView new];
fingerprintImageView.image = self.fingerprint.image; fingerprintImageView.image = self.fingerprint.image;

@ -80,7 +80,7 @@ class ReminderView: UIView {
self.addSubview(container) self.addSubview(container)
container.layoutMargins = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16) container.layoutMargins = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16)
container.autoPinToSuperviewEdges() container.ows_autoPinToSuperviewEdges()
// Label // Label
label.font = UIFont.ows_dynamicTypeSubheadline label.font = UIFont.ows_dynamicTypeSubheadline

@ -41,7 +41,7 @@ public class OWSFlatButton: UIView {
private func createContent() { private func createContent() {
self.addSubview(button) self.addSubview(button)
button.addTarget(self, action: #selector(buttonPressed), for: .touchUpInside) button.addTarget(self, action: #selector(buttonPressed), for: .touchUpInside)
button.autoPinToSuperviewEdges() button.ows_autoPinToSuperviewEdges()
} }
@objc @objc

@ -109,7 +109,7 @@ public class PlayerProgressBar: UIView {
backgroundColor = UIColor.lightGray.withAlphaComponent(0.5) backgroundColor = UIColor.lightGray.withAlphaComponent(0.5)
if !UIAccessibilityIsReduceTransparencyEnabled() { if !UIAccessibilityIsReduceTransparencyEnabled() {
addSubview(blurEffectView) addSubview(blurEffectView)
blurEffectView.autoPinToSuperviewEdges() blurEffectView.ows_autoPinToSuperviewEdges()
} }
// Configure controls // Configure controls

@ -27,8 +27,8 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
- (NSArray<NSLayoutConstraint *> *)autoPinHeightToSuperviewWithMargin:(CGFloat)margin; - (NSArray<NSLayoutConstraint *> *)autoPinHeightToSuperviewWithMargin:(CGFloat)margin;
- (NSArray<NSLayoutConstraint *> *)autoPinHeightToSuperview; - (NSArray<NSLayoutConstraint *> *)autoPinHeightToSuperview;
- (NSArray<NSLayoutConstraint *> *)autoPinToSuperviewEdges; - (NSArray<NSLayoutConstraint *> *)ows_autoPinToSuperviewEdges;
- (NSArray<NSLayoutConstraint *> *)autoPinToSuperviewMargins; - (NSArray<NSLayoutConstraint *> *)ows_autoPinToSuperviewMargins;
- (NSLayoutConstraint *)autoHCenterInSuperview; - (NSLayoutConstraint *)autoHCenterInSuperview;
- (NSLayoutConstraint *)autoVCenterInSuperview; - (NSLayoutConstraint *)autoVCenterInSuperview;

@ -79,7 +79,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
return result; return result;
} }
- (NSArray<NSLayoutConstraint *> *)autoPinToSuperviewEdges - (NSArray<NSLayoutConstraint *> *)ows_autoPinToSuperviewEdges
{ {
NSArray<NSLayoutConstraint *> *result = @[ NSArray<NSLayoutConstraint *> *result = @[
[self autoPinEdgeToSuperviewEdge:ALEdgeLeft], [self autoPinEdgeToSuperviewEdge:ALEdgeLeft],
@ -90,7 +90,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
return result; return result;
} }
- (NSArray<NSLayoutConstraint *> *)autoPinToSuperviewMargins - (NSArray<NSLayoutConstraint *> *)ows_autoPinToSuperviewMargins
{ {
NSArray<NSLayoutConstraint *> *result = @[ NSArray<NSLayoutConstraint *> *result = @[
[self autoPinTopToSuperviewMargin], [self autoPinTopToSuperviewMargin],

Loading…
Cancel
Save