Browse Source

support safeAreaLayoutGuide - rename

iwill 8 years ago
parent
commit
53a095b89a

+ 19 - 19
Examples/Masonry iOS Examples/MASExampleSafeAreaLayoutGuideViewController.m

@@ -54,66 +54,66 @@
     const CGFloat size = 50.0;
     const CGFloat size = 50.0;
     
     
     [view1 mas_makeConstraints:^(MASConstraintMaker *make) {
     [view1 mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.edges.equalTo(self.view.mas_safeArea).inset(10.0);
+        make.edges.equalTo(self.view.mas_safeAreaLayoutGuide).inset(10.0);
     }];
     }];
     
     
     [view2 mas_makeConstraints:^(MASConstraintMaker *make) {
     [view2 mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.center.equalTo(self.view.mas_safeArea);
-        make.width.height.equalTo(self.view.mas_safeArea).sizeOffset(CGSizeMake(- 40.0, - 40.0));
+        make.center.equalTo(self.view.mas_safeAreaLayoutGuide);
+        make.width.height.equalTo(self.view.mas_safeAreaLayoutGuide).sizeOffset(CGSizeMake(- 40.0, - 40.0));
     }];
     }];
     
     
     [view3 mas_makeConstraints:^(MASConstraintMaker *make) {
     [view3 mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.center.equalTo(self.view.mas_safeArea);
-        make.width.equalTo(self.view.mas_safeArea).sizeOffset(CGSizeMake(- 60.0, - 60.0));
-        make.height.equalTo(self.view.mas_safeArea).sizeOffset(CGSizeMake(- 60.0, - 60.0));
+        make.center.equalTo(self.view.mas_safeAreaLayoutGuide);
+        make.width.equalTo(self.view.mas_safeAreaLayoutGuide).sizeOffset(CGSizeMake(- 60.0, - 60.0));
+        make.height.equalTo(self.view.mas_safeAreaLayoutGuide).sizeOffset(CGSizeMake(- 60.0, - 60.0));
     }];
     }];
     
     
     [leftTopView mas_makeConstraints:^(MASConstraintMaker *make) {
     [leftTopView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.top.equalTo(self.view.mas_safeArea);
+        make.left.top.equalTo(self.view.mas_safeAreaLayoutGuide);
         make.width.height.equalTo(@(size));
         make.width.height.equalTo(@(size));
     }];
     }];
     
     
     [rightTopView mas_makeConstraints:^(MASConstraintMaker *make) {
     [rightTopView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.right.equalTo(self.view.mas_safeAreaRight);
-        make.top.equalTo(self.view.mas_safeAreaTop);
+        make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);
+        make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
         make.width.height.equalTo(@(size));
         make.width.height.equalTo(@(size));
     }];
     }];
     
     
     [leftBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
     [leftBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.equalTo(self.view.mas_safeAreaLeft);
-        make.bottom.equalTo(self.view.mas_safeAreaBottom);
+        make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft);
+        make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
         make.width.height.equalTo(@(size));
         make.width.height.equalTo(@(size));
     }];
     }];
     
     
     [rightBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
     [rightBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.right.bottom.equalTo(self.view.mas_safeArea);
+        make.right.bottom.equalTo(self.view.mas_safeAreaLayoutGuide);
         make.width.height.equalTo(@(size));
         make.width.height.equalTo(@(size));
     }];
     }];
     
     
     [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
     [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.centerY.equalTo(self.view.mas_safeArea);
+        make.left.centerY.equalTo(self.view.mas_safeAreaLayoutGuide);
         make.width.height.equalTo(@(size));
         make.width.height.equalTo(@(size));
     }];
     }];
     
     
     [rightView mas_makeConstraints:^(MASConstraintMaker *make) {
     [rightView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.right.equalTo(self.view.mas_safeAreaRight);
-        make.centerY.equalTo(self.view.mas_safeAreaCenterY);
+        make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);
+        make.centerY.equalTo(self.view.mas_safeAreaLayoutGuideCenterY);
         make.width.height.equalTo(@(size));
         make.width.height.equalTo(@(size));
     }];
     }];
     
     
     [topView mas_makeConstraints:^(MASConstraintMaker *make) {
     [topView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.view.mas_safeAreaTop);
-        make.centerX.equalTo(self.view.mas_safeAreaCenterX);
+        make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
+        make.centerX.equalTo(self.view.mas_safeAreaLayoutGuideCenterX);
         make.width.height.equalTo(@(size));
         make.width.height.equalTo(@(size));
     }];
     }];
     
     
     [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
     [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.bottom.centerX.equalTo(self.view.mas_safeArea);
+        make.bottom.centerX.equalTo(self.view.mas_safeAreaLayoutGuide);
         make.width.height.equalTo(@(size));
         make.width.height.equalTo(@(size));
     }];
     }];
     
     
     [centerView mas_makeConstraints:^(MASConstraintMaker *make) {
     [centerView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.center.equalTo(self.view.mas_safeArea);
+        make.center.equalTo(self.view.mas_safeAreaLayoutGuide);
         make.width.height.equalTo(@(size));
         make.width.height.equalTo(@(size));
     }];
     }];
 }
 }

+ 12 - 18
Masonry/View+MASAdditions.h

@@ -54,24 +54,18 @@
 
 
 #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
 #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
 
 
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeArea;
-
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLeading;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaTrailing;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLeft;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaRight;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaTop;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaBottom;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaWidth;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaHeight;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaCenterX;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaCenterY;
-
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide DEPRECATED_ATTRIBUTE;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop DEPRECATED_ATTRIBUTE;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom DEPRECATED_ATTRIBUTE;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft DEPRECATED_ATTRIBUTE;
-@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight DEPRECATED_ATTRIBUTE;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide;
+
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeading;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTrailing;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideWidth;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideHeight;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideCenterX;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideCenterY;
 
 
 #endif
 #endif
 
 

+ 11 - 31
Masonry/View+MASAdditions.m

@@ -136,70 +136,50 @@
 
 
 #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
 #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
 
 
-#pragma mark - safeAreaLayoutGuide
-
-- (MASViewAttribute *)mas_safeArea {
+- (MASViewAttribute *)mas_safeAreaLayoutGuide {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeNotAnAttribute];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeNotAnAttribute];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaLeading {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideLeading {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeading];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeading];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaTrailing {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideTrailing {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTrailing];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTrailing];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaLeft {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideLeft {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaRight {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideRight {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaTop {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideTop {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaBottom {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideBottom {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaWidth {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideWidth {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeWidth];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeWidth];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaHeight {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideHeight {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeHeight];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeHeight];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaCenterX {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideCenterX {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterX];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterX];
 }
 }
 
 
-- (MASViewAttribute *)mas_safeAreaCenterY {
+- (MASViewAttribute *)mas_safeAreaLayoutGuideCenterY {
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterY];
     return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterY];
 }
 }
 
 
-#pragma mark - DEPRECATED
-
-- (MASViewAttribute *)mas_safeAreaLayoutGuide {
-    return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
-}
-- (MASViewAttribute *)mas_safeAreaLayoutGuideTop {
-    return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop];
-}
-- (MASViewAttribute *)mas_safeAreaLayoutGuideBottom {
-    return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
-}
-- (MASViewAttribute *)mas_safeAreaLayoutGuideLeft {
-    return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft];
-}
-- (MASViewAttribute *)mas_safeAreaLayoutGuideRight {
-    return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight];
-}
-
 #endif
 #endif
 
 
 #pragma mark - associated properties
 #pragma mark - associated properties