From 21f14711ced753fed2ce686cb6c7cd50fd2a2049 Mon Sep 17 00:00:00 2001 From: "Republic of Apps, LLC" Date: Mon, 13 Apr 2015 22:36:01 -0700 Subject: [PATCH] Added disableAnimator method so we can disable constraint animator proxy when no longer needed. --- Masonry/MASCompositeConstraint.m | 6 ++++++ Masonry/MASConstraint.h | 5 +++++ Masonry/MASConstraint.m | 1 + Masonry/MASViewConstraint.m | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/Masonry/MASCompositeConstraint.m b/Masonry/MASCompositeConstraint.m index fd1e8c87..fbfe258a 100644 --- a/Masonry/MASCompositeConstraint.m +++ b/Masonry/MASCompositeConstraint.m @@ -106,6 +106,12 @@ - (MASConstraint *)animator { return self; } +- (void)disableAnimator { + for (MASConstraint *constraint in self.childConstraints) { + [constraint disableAnimator]; + } +} + #endif #pragma mark - debug helpers diff --git a/Masonry/MASConstraint.h b/Masonry/MASConstraint.h index a4b7a781..46c400f9 100644 --- a/Masonry/MASConstraint.h +++ b/Masonry/MASConstraint.h @@ -183,6 +183,11 @@ * Whether or not to go through the animator proxy when modifying the constraint */ @property (nonatomic, copy, readonly) MASConstraint *animator; + +/** + * Disable use of the animator proxy. To re-enable, simply use the animator property again. + */ +- (void)disableAnimator; #endif /** diff --git a/Masonry/MASConstraint.m b/Masonry/MASConstraint.m index 8497912e..a7eefe89 100644 --- a/Masonry/MASConstraint.m +++ b/Masonry/MASConstraint.m @@ -267,6 +267,7 @@ - (void)setOffset:(CGFloat __unused)offset { MASMethodNotImplemented(); } #if TARGET_OS_MAC && !TARGET_OS_IPHONE - (MASConstraint *)animator { MASMethodNotImplemented(); } +- (void)disableAnimator { MASMethodNotImplemented(); } #endif diff --git a/Masonry/MASViewConstraint.m b/Masonry/MASViewConstraint.m index 8e3d2d6a..5ffca6c6 100644 --- a/Masonry/MASViewConstraint.m +++ b/Masonry/MASViewConstraint.m @@ -218,6 +218,10 @@ - (MASConstraint *)animator { return self; } +- (void)disableAnimator { + self.useAnimator = NO; +} + #endif #pragma mark - debug helpers