Committed by
GitHub
Merge pull request #457 from cntrump/master
support safeAreaLayoutGuide of iOS 11
Showing
3 changed files
with
48 additions
and
0 deletions
@@ -52,6 +52,16 @@ | @@ -52,6 +52,16 @@ | ||
52 | 52 | ||
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | +#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) | ||
56 | + | ||
57 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide API_AVAILABLE(ios(11.0),tvos(11.0)); | ||
58 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop API_AVAILABLE(ios(11.0),tvos(11.0)); | ||
59 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom API_AVAILABLE(ios(11.0),tvos(11.0)); | ||
60 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft API_AVAILABLE(ios(11.0),tvos(11.0)); | ||
61 | +@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight API_AVAILABLE(ios(11.0),tvos(11.0)); | ||
62 | + | ||
63 | +#endif | ||
64 | + | ||
55 | /** | 65 | /** |
56 | * a key to associate with this view | 66 | * a key to associate with this view |
57 | */ | 67 | */ |
@@ -134,6 +134,26 @@ | @@ -134,6 +134,26 @@ | ||
134 | 134 | ||
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | +#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) | ||
138 | + | ||
139 | +- (MASViewAttribute *)mas_safeAreaLayoutGuide { | ||
140 | + return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; | ||
141 | +} | ||
142 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideTop { | ||
143 | + return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop]; | ||
144 | +} | ||
145 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideBottom { | ||
146 | + return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; | ||
147 | +} | ||
148 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideLeft { | ||
149 | + return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft]; | ||
150 | +} | ||
151 | +- (MASViewAttribute *)mas_safeAreaLayoutGuideRight { | ||
152 | + return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight]; | ||
153 | +} | ||
154 | + | ||
155 | +#endif | ||
156 | + | ||
137 | #pragma mark - associated properties | 157 | #pragma mark - associated properties |
138 | 158 | ||
139 | - (id)mas_key { | 159 | - (id)mas_key { |
@@ -49,6 +49,15 @@ | @@ -49,6 +49,15 @@ | ||
49 | 49 | ||
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | +#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) | ||
53 | + | ||
54 | +@property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideTop API_AVAILABLE(ios(11.0),tvos(11.0)); | ||
55 | +@property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideBottom API_AVAILABLE(ios(11.0),tvos(11.0)); | ||
56 | +@property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideLeft API_AVAILABLE(ios(11.0),tvos(11.0)); | ||
57 | +@property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideRight API_AVAILABLE(ios(11.0),tvos(11.0)); | ||
58 | + | ||
59 | +#endif | ||
60 | + | ||
52 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; | 61 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; |
53 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; | 62 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; |
54 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; | 63 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; |
@@ -94,6 +103,15 @@ MAS_ATTR_FORWARD(centerYWithinMargins); | @@ -94,6 +103,15 @@ MAS_ATTR_FORWARD(centerYWithinMargins); | ||
94 | 103 | ||
95 | #endif | 104 | #endif |
96 | 105 | ||
106 | +#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) | ||
107 | + | ||
108 | +MAS_ATTR_FORWARD(safeAreaLayoutGuideTop); | ||
109 | +MAS_ATTR_FORWARD(safeAreaLayoutGuideBottom); | ||
110 | +MAS_ATTR_FORWARD(safeAreaLayoutGuideLeft); | ||
111 | +MAS_ATTR_FORWARD(safeAreaLayoutGuideRight); | ||
112 | + | ||
113 | +#endif | ||
114 | + | ||
97 | - (MASViewAttribute *(^)(NSLayoutAttribute))attribute { | 115 | - (MASViewAttribute *(^)(NSLayoutAttribute))attribute { |
98 | return [self mas_attribute]; | 116 | return [self mas_attribute]; |
99 | } | 117 | } |
-
Please register or login to post a comment