From 7ab063d5c658143b5bce7ca8e5ae9bfc700bb1d8 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期一, 01 二月 2021 18:22:29 +0800 Subject: [PATCH] 2021-02-01 1.更新 --- EZSDK/EZSDK/EZ/Venders/Masonry/MASViewConstraint.m | 40 ++++++++++++++++++++++------------------ 1 files changed, 22 insertions(+), 18 deletions(-) diff --git a/EZSDK/EZSDK/EZ/Venders/Masonry/MASViewConstraint.m b/EZSDK/EZSDK/EZ/Venders/Masonry/MASViewConstraint.m old mode 100644 new mode 100755 index b0f3650..173eec1 --- a/EZSDK/EZSDK/EZ/Venders/Masonry/MASViewConstraint.m +++ b/EZSDK/EZSDK/EZ/Venders/Masonry/MASViewConstraint.m @@ -1,5 +1,5 @@ // -// MASConstraint.m +// MASViewConstraint.m // Masonry // // Created by Jonas Budelmann on 20/07/13. @@ -86,7 +86,7 @@ - (void)setLayoutConstant:(CGFloat)layoutConstant { _layoutConstant = layoutConstant; -#if TARGET_OS_MAC && !TARGET_OS_IPHONE +#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) if (self.useAnimator) { [self.layoutConstraint.animator setConstant:layoutConstant]; } else { @@ -175,6 +175,7 @@ NSMutableArray *children = NSMutableArray.new; for (id attr in attribute) { MASViewConstraint *viewConstraint = [self copy]; + viewConstraint.layoutRelation = relation; viewConstraint.secondViewAttribute = attr; [children addObject:viewConstraint]; } @@ -211,7 +212,7 @@ #pragma mark - Animator proxy -#if TARGET_OS_MAC && !TARGET_OS_IPHONE +#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) - (MASConstraint *)animator { self.useAnimator = YES; @@ -253,6 +254,10 @@ } } +- (void)setInset:(CGFloat)inset { + [self setInsets:(MASEdgeInsets){.top = inset, .left = inset, .bottom = inset, .right = inset}]; +} + - (void)setOffset:(CGFloat)offset { self.layoutConstant = offset; } @@ -288,28 +293,21 @@ #pragma mark - MASConstraint - (void)activate { - if ([self supportsActiveProperty] && self.layoutConstraint) { - if (self.hasBeenInstalled) { - return; - } - self.layoutConstraint.active = YES; - [self.firstViewAttribute.view.mas_installedConstraints addObject:self]; - } else { - [self install]; - } + [self install]; } - (void)deactivate { - if ([self supportsActiveProperty]) { - self.layoutConstraint.active = NO; - [self.firstViewAttribute.view.mas_installedConstraints removeObject:self]; - } else { - [self uninstall]; - } + [self uninstall]; } - (void)install { if (self.hasBeenInstalled) { + return; + } + + if ([self supportsActiveProperty] && self.layoutConstraint) { + self.layoutConstraint.active = YES; + [self.firstViewAttribute.view.mas_installedConstraints addObject:self]; return; } @@ -387,6 +385,12 @@ } - (void)uninstall { + if ([self supportsActiveProperty]) { + self.layoutConstraint.active = NO; + [self.firstViewAttribute.view.mas_installedConstraints removeObject:self]; + return; + } + [self.installedView removeConstraint:self.layoutConstraint]; self.layoutConstraint = nil; self.installedView = nil; -- Gitblit v1.8.0