From acffd40a43851d22300d24b97c12dad28285bda6 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Tue, 19 Mar 2019 11:16:46 -0400 Subject: [PATCH 1/2] Priorites need to be set before activations. --- MVMCoreUI/Atoms/Views/MFLoadImageView.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/MFLoadImageView.m b/MVMCoreUI/Atoms/Views/MFLoadImageView.m index 2a0572da..05444f03 100644 --- a/MVMCoreUI/Atoms/Views/MFLoadImageView.m +++ b/MVMCoreUI/Atoms/Views/MFLoadImageView.m @@ -211,28 +211,32 @@ if (self.addSizeConstraintsForAspectRatio) { if (width && height) { NSLayoutConstraint *constraint = [self.imageView.heightAnchor constraintEqualToConstant:height.floatValue]; + constraint.priority = 900; constraint.active = YES; self.heightConstraint = constraint; constraint = [self.imageView.widthAnchor constraintEqualToConstant:width.floatValue]; + constraint.priority = 900; constraint.active = YES; self.widthConstraint = constraint; } else if (width) { NSLayoutConstraint *constraint = [self.imageView.widthAnchor constraintEqualToConstant:width.floatValue]; + constraint.priority = 900; constraint.active = YES; self.widthConstraint = constraint; constraint = [self.imageView.heightAnchor constraintEqualToAnchor:self.imageView.widthAnchor multiplier:size.height/size.width]; + constraint.priority = 900; constraint.active = YES; self.heightConstraint = constraint; } else if (height) { NSLayoutConstraint *constraint = [self.imageView.heightAnchor constraintEqualToConstant:height.floatValue]; + constraint.priority = 900; constraint.active = YES; self.heightConstraint = constraint; constraint = [self.imageView.widthAnchor constraintEqualToAnchor:self.imageView.heightAnchor multiplier:size.width/size.height]; + constraint.priority = 900; constraint.active = YES; self.widthConstraint = constraint; } - self.widthConstraint.priority = 900; - self.heightConstraint.priority = 900; [self.imageView setContentHuggingPriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal]; [self.imageView setContentHuggingPriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisVertical]; } From 7341e6930c0edd04ded2c555955b62d0df22460e Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 22 Mar 2019 12:06:24 -0400 Subject: [PATCH 2/2] Fix mfloadimageView to swift crash --- MVMCoreUI/Atoms/Views/MFLoadImageView.swift | 2 +- MVMCoreUI/Atoms/Views/MFView.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift index f707253b..257fe041 100644 --- a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift +++ b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift @@ -36,7 +36,7 @@ import UIKit super.init(frame: .zero) } - required public init?(coder aDecoder: NSCoder) { + public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } diff --git a/MVMCoreUI/Atoms/Views/MFView.m b/MVMCoreUI/Atoms/Views/MFView.m index b2047c45..1ab4cda1 100644 --- a/MVMCoreUI/Atoms/Views/MFView.m +++ b/MVMCoreUI/Atoms/Views/MFView.m @@ -26,8 +26,8 @@ return self; } -- (instancetype)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; +- (instancetype)initWithCoder:(NSCoder *)coder { + self = [super initWithCoder:coder]; if (self) { [self setupView]; }