support safeAreaLayoutGuide - rename
Showing
3 changed files
with
42 additions
and
68 deletions
@@ -54,66 +54,66 @@ | @@ -54,66 +54,66 @@ | ||
54 | const CGFloat size = 50.0; | 54 | const CGFloat size = 50.0; |
55 | 55 | ||
56 | [view1 mas_makeConstraints:^(MASConstraintMaker *make) { | 56 | [view1 mas_makeConstraints:^(MASConstraintMaker *make) { |
57 | - make.edges.equalTo(self.view.mas_safeArea).inset(10.0); | 57 | + make.edges.equalTo(self.view.mas_safeAreaLayoutGuide).inset(10.0); |
58 | }]; | 58 | }]; |
59 | 59 | ||
60 | [view2 mas_makeConstraints:^(MASConstraintMaker *make) { | 60 | [view2 mas_makeConstraints:^(MASConstraintMaker *make) { |
61 | - make.center.equalTo(self.view.mas_safeArea); | ||
62 | - make.width.height.equalTo(self.view.mas_safeArea).sizeOffset(CGSizeMake(- 40.0, - 40.0)); | 61 | + make.center.equalTo(self.view.mas_safeAreaLayoutGuide); |
62 | + make.width.height.equalTo(self.view.mas_safeAreaLayoutGuide).sizeOffset(CGSizeMake(- 40.0, - 40.0)); | ||
63 | }]; | 63 | }]; |
64 | 64 | ||
65 | [view3 mas_makeConstraints:^(MASConstraintMaker *make) { | 65 | [view3 mas_makeConstraints:^(MASConstraintMaker *make) { |
66 | - make.center.equalTo(self.view.mas_safeArea); | ||
67 | - make.width.equalTo(self.view.mas_safeArea).sizeOffset(CGSizeMake(- 60.0, - 60.0)); | ||
68 | - make.height.equalTo(self.view.mas_safeArea).sizeOffset(CGSizeMake(- 60.0, - 60.0)); | 66 | + make.center.equalTo(self.view.mas_safeAreaLayoutGuide); |
67 | + make.width.equalTo(self.view.mas_safeAreaLayoutGuide).sizeOffset(CGSizeMake(- 60.0, - 60.0)); | ||
68 | + make.height.equalTo(self.view.mas_safeAreaLayoutGuide).sizeOffset(CGSizeMake(- 60.0, - 60.0)); | ||
69 | }]; | 69 | }]; |
70 | 70 | ||
71 | [leftTopView mas_makeConstraints:^(MASConstraintMaker *make) { | 71 | [leftTopView mas_makeConstraints:^(MASConstraintMaker *make) { |
72 | - make.left.top.equalTo(self.view.mas_safeArea); | 72 | + make.left.top.equalTo(self.view.mas_safeAreaLayoutGuide); |
73 | make.width.height.equalTo(@(size)); | 73 | make.width.height.equalTo(@(size)); |
74 | }]; | 74 | }]; |
75 | 75 | ||
76 | [rightTopView mas_makeConstraints:^(MASConstraintMaker *make) { | 76 | [rightTopView mas_makeConstraints:^(MASConstraintMaker *make) { |
77 | - make.right.equalTo(self.view.mas_safeAreaRight); | ||
78 | - make.top.equalTo(self.view.mas_safeAreaTop); | 77 | + make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight); |
78 | + make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop); | ||
79 | make.width.height.equalTo(@(size)); | 79 | make.width.height.equalTo(@(size)); |
80 | }]; | 80 | }]; |
81 | 81 | ||
82 | [leftBottomView mas_makeConstraints:^(MASConstraintMaker *make) { | 82 | [leftBottomView mas_makeConstraints:^(MASConstraintMaker *make) { |
83 | - make.left.equalTo(self.view.mas_safeAreaLeft); | ||
84 | - make.bottom.equalTo(self.view.mas_safeAreaBottom); | 83 | + make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft); |
84 | + make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom); | ||
85 | make.width.height.equalTo(@(size)); | 85 | make.width.height.equalTo(@(size)); |
86 | }]; | 86 | }]; |
87 | 87 | ||
88 | [rightBottomView mas_makeConstraints:^(MASConstraintMaker *make) { | 88 | [rightBottomView mas_makeConstraints:^(MASConstraintMaker *make) { |
89 | - make.right.bottom.equalTo(self.view.mas_safeArea); | 89 | + make.right.bottom.equalTo(self.view.mas_safeAreaLayoutGuide); |
90 | make.width.height.equalTo(@(size)); | 90 | make.width.height.equalTo(@(size)); |
91 | }]; | 91 | }]; |
92 | 92 | ||
93 | [leftView mas_makeConstraints:^(MASConstraintMaker *make) { | 93 | [leftView mas_makeConstraints:^(MASConstraintMaker *make) { |
94 | - make.left.centerY.equalTo(self.view.mas_safeArea); | 94 | + make.left.centerY.equalTo(self.view.mas_safeAreaLayoutGuide); |
95 | make.width.height.equalTo(@(size)); | 95 | make.width.height.equalTo(@(size)); |
96 | }]; | 96 | }]; |
97 | 97 | ||
98 | [rightView mas_makeConstraints:^(MASConstraintMaker *make) { | 98 | [rightView mas_makeConstraints:^(MASConstraintMaker *make) { |
99 | - make.right.equalTo(self.view.mas_safeAreaRight); | ||
100 | - make.centerY.equalTo(self.view.mas_safeAreaCenterY); | 99 | + make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight); |
100 | + make.centerY.equalTo(self.view.mas_safeAreaLayoutGuideCenterY); | ||
101 | make.width.height.equalTo(@(size)); | 101 | make.width.height.equalTo(@(size)); |
102 | }]; | 102 | }]; |
103 | 103 | ||
104 | [topView mas_makeConstraints:^(MASConstraintMaker *make) { | 104 | [topView mas_makeConstraints:^(MASConstraintMaker *make) { |
105 | - make.top.equalTo(self.view.mas_safeAreaTop); | ||
106 | - make.centerX.equalTo(self.view.mas_safeAreaCenterX); | 105 | + make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop); |
106 | + make.centerX.equalTo(self.view.mas_safeAreaLayoutGuideCenterX); | ||
107 | make.width.height.equalTo(@(size)); | 107 | make.width.height.equalTo(@(size)); |
108 | }]; | 108 | }]; |
109 | 109 | ||
110 | [bottomView mas_makeConstraints:^(MASConstraintMaker *make) { | 110 | [bottomView mas_makeConstraints:^(MASConstraintMaker *make) { |
111 | - make.bottom.centerX.equalTo(self.view.mas_safeArea); | 111 | + make.bottom.centerX.equalTo(self.view.mas_safeAreaLayoutGuide); |
112 | make.width.height.equalTo(@(size)); | 112 | make.width.height.equalTo(@(size)); |
113 | }]; | 113 | }]; |
114 | 114 | ||
115 | [centerView mas_makeConstraints:^(MASConstraintMaker *make) { | 115 | [centerView mas_makeConstraints:^(MASConstraintMaker *make) { |
116 | - make.center.equalTo(self.view.mas_safeArea); | 116 | + make.center.equalTo(self.view.mas_safeAreaLayoutGuide); |
117 | make.width.height.equalTo(@(size)); | 117 | make.width.height.equalTo(@(size)); |
118 | }]; | 118 | }]; |
119 | } | 119 | } |
@@ -54,24 +54,18 @@ | @@ -54,24 +54,18 @@ | ||
54 | 54 | ||
55 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000) | 55 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000) |
56 | 56 | ||
57 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeArea; | ||
58 | - | ||
59 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLeading; | ||
60 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaTrailing; | ||
61 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLeft; | ||
62 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaRight; | ||
63 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaTop; | ||
64 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaBottom; | ||
65 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaWidth; | ||
66 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaHeight; | ||
67 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaCenterX; | ||
68 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaCenterY; | ||
69 | - | ||
70 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide DEPRECATED_ATTRIBUTE; | ||
71 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop DEPRECATED_ATTRIBUTE; | ||
72 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom DEPRECATED_ATTRIBUTE; | ||
73 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft DEPRECATED_ATTRIBUTE; | ||
74 | -@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight DEPRECATED_ATTRIBUTE; | 57 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide; |
58 | + | ||
59 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeading; | ||
60 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTrailing; | ||
61 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft; | ||
62 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight; | ||
63 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop; | ||
64 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom; | ||
65 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideWidth; | ||
66 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideHeight; | ||
67 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideCenterX; | ||
68 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideCenterY; | ||
75 | 69 | ||
76 | #endif | 70 | #endif |
77 | 71 |
@@ -136,70 +136,50 @@ | @@ -136,70 +136,50 @@ | ||
136 | 136 | ||
137 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000) | 137 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000) |
138 | 138 | ||
139 | -#pragma mark - safeAreaLayoutGuide | ||
140 | - | ||
141 | -- (MASViewAttribute *)mas_safeArea { | 139 | +- (MASViewAttribute *)mas_safeAreaLayoutGuide { |
142 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeNotAnAttribute]; | 140 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeNotAnAttribute]; |
143 | } | 141 | } |
144 | 142 | ||
145 | -- (MASViewAttribute *)mas_safeAreaLeading { | 143 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideLeading { |
146 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeading]; | 144 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeading]; |
147 | } | 145 | } |
148 | 146 | ||
149 | -- (MASViewAttribute *)mas_safeAreaTrailing { | 147 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideTrailing { |
150 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTrailing]; | 148 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTrailing]; |
151 | } | 149 | } |
152 | 150 | ||
153 | -- (MASViewAttribute *)mas_safeAreaLeft { | 151 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideLeft { |
154 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft]; | 152 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft]; |
155 | } | 153 | } |
156 | 154 | ||
157 | -- (MASViewAttribute *)mas_safeAreaRight { | 155 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideRight { |
158 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight]; | 156 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight]; |
159 | } | 157 | } |
160 | 158 | ||
161 | -- (MASViewAttribute *)mas_safeAreaTop { | 159 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideTop { |
162 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop]; | 160 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop]; |
163 | } | 161 | } |
164 | 162 | ||
165 | -- (MASViewAttribute *)mas_safeAreaBottom { | 163 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideBottom { |
166 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; | 164 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; |
167 | } | 165 | } |
168 | 166 | ||
169 | -- (MASViewAttribute *)mas_safeAreaWidth { | 167 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideWidth { |
170 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeWidth]; | 168 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeWidth]; |
171 | } | 169 | } |
172 | 170 | ||
173 | -- (MASViewAttribute *)mas_safeAreaHeight { | 171 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideHeight { |
174 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeHeight]; | 172 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeHeight]; |
175 | } | 173 | } |
176 | 174 | ||
177 | -- (MASViewAttribute *)mas_safeAreaCenterX { | 175 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideCenterX { |
178 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterX]; | 176 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterX]; |
179 | } | 177 | } |
180 | 178 | ||
181 | -- (MASViewAttribute *)mas_safeAreaCenterY { | 179 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideCenterY { |
182 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterY]; | 180 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterY]; |
183 | } | 181 | } |
184 | 182 | ||
185 | -#pragma mark - DEPRECATED | ||
186 | - | ||
187 | -- (MASViewAttribute *)mas_safeAreaLayoutGuide { | ||
188 | - return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; | ||
189 | -} | ||
190 | -- (MASViewAttribute *)mas_safeAreaLayoutGuideTop { | ||
191 | - return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop]; | ||
192 | -} | ||
193 | -- (MASViewAttribute *)mas_safeAreaLayoutGuideBottom { | ||
194 | - return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; | ||
195 | -} | ||
196 | -- (MASViewAttribute *)mas_safeAreaLayoutGuideLeft { | ||
197 | - return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft]; | ||
198 | -} | ||
199 | -- (MASViewAttribute *)mas_safeAreaLayoutGuideRight { | ||
200 | - return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight]; | ||
201 | -} | ||
202 | - | ||
203 | #endif | 183 | #endif |
204 | 184 | ||
205 | #pragma mark - associated properties | 185 | #pragma mark - associated properties |
-
Please register or login to post a comment