-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
122 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// NSLayoutGuide+MASAdditions.h | ||
// LayoutGuide+MASAdditions.h | ||
// Masonry | ||
// | ||
// Created by v on 2021/5/30. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// NSLayoutGuide+MASAdditions.m | ||
// LayoutGuide+MASAdditions.m | ||
// Masonry | ||
// | ||
// Created by v on 2021/5/30. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// | ||
// LayoutGuide+MASShorthandAdditions.h | ||
// Masonry | ||
// | ||
// Created by v on 2021/6/1. | ||
// Copyright © 2021 Jonas Budelmann. All rights reserved. | ||
// | ||
|
||
#import "LayoutGuide+MASAdditions.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
#ifdef MAS_SHORTHAND | ||
|
||
/** | ||
* Shorthand view additions without the 'mas_' prefixes, | ||
* only enabled if MAS_SHORTHAND is defined | ||
*/ | ||
API_AVAILABLE(macos(10.11), ios(9.0)) | ||
@interface MASLayoutGuide (MASShorthandAdditions) | ||
|
||
@property (nonatomic, strong, readonly) MASViewAttribute *left; | ||
@property (nonatomic, strong, readonly) MASViewAttribute *top; | ||
@property (nonatomic, strong, readonly) MASViewAttribute *right; | ||
@property (nonatomic, strong, readonly) MASViewAttribute *bottom; | ||
@property (nonatomic, strong, readonly) MASViewAttribute *leading; | ||
@property (nonatomic, strong, readonly) MASViewAttribute *trailing; | ||
@property (nonatomic, strong, readonly) MASViewAttribute *width; | ||
@property (nonatomic, strong, readonly) MASViewAttribute *height; | ||
@property (nonatomic, strong, readonly) MASViewAttribute *centerX; | ||
@property (nonatomic, strong, readonly) MASViewAttribute *centerY; | ||
|
||
@property (nonatomic, strong, readonly) MASViewAttribute *(^attribute)(NSLayoutAttribute attr); | ||
|
||
- (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; | ||
- (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; | ||
- (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; | ||
|
||
@end | ||
|
||
@implementation MASLayoutGuide (MASShorthandAdditions) | ||
|
||
MAS_ATTR_FORWARD(top); | ||
MAS_ATTR_FORWARD(left); | ||
MAS_ATTR_FORWARD(bottom); | ||
MAS_ATTR_FORWARD(right); | ||
MAS_ATTR_FORWARD(leading); | ||
MAS_ATTR_FORWARD(trailing); | ||
MAS_ATTR_FORWARD(width); | ||
MAS_ATTR_FORWARD(height); | ||
MAS_ATTR_FORWARD(centerX); | ||
MAS_ATTR_FORWARD(centerY); | ||
|
||
- (MASViewAttribute *(^)(NSLayoutAttribute))attribute { | ||
return [self mas_attribute]; | ||
} | ||
|
||
- (NSArray *)makeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block { | ||
return [self mas_makeConstraints:block]; | ||
} | ||
|
||
- (NSArray *)updateConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block { | ||
return [self mas_updateConstraints:block]; | ||
} | ||
|
||
- (NSArray *)remakeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block { | ||
return [self mas_remakeConstraints:block]; | ||
} | ||
|
||
@end | ||
|
||
#endif | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters