123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- #import "MASUtilities.h"
- @interface MASConstraint : NSObject
- - (MASConstraint * (^)(MASEdgeInsets insets))insets;
- - (MASConstraint * (^)(CGFloat inset))inset;
- - (MASConstraint * (^)(CGSize offset))sizeOffset;
- - (MASConstraint * (^)(CGPoint offset))centerOffset;
- - (MASConstraint * (^)(CGFloat offset))offset;
- - (MASConstraint * (^)(NSValue *value))valueOffset;
- - (MASConstraint * (^)(CGFloat multiplier))multipliedBy;
- - (MASConstraint * (^)(CGFloat divider))dividedBy;
- - (MASConstraint * (^)(MASLayoutPriority priority))priority;
- - (MASConstraint * (^)(void))priorityLow;
- - (MASConstraint * (^)(void))priorityMedium;
- - (MASConstraint * (^)(void))priorityHigh;
- - (MASConstraint * (^)(id attr))equalTo;
- - (MASConstraint * (^)(id attr))greaterThanOrEqualTo;
- - (MASConstraint * (^)(id attr))lessThanOrEqualTo;
- - (MASConstraint *)with;
- - (MASConstraint *)and;
- - (MASConstraint *)left;
- - (MASConstraint *)top;
- - (MASConstraint *)right;
- - (MASConstraint *)bottom;
- - (MASConstraint *)leading;
- - (MASConstraint *)trailing;
- - (MASConstraint *)width;
- - (MASConstraint *)height;
- - (MASConstraint *)centerX;
- - (MASConstraint *)centerY;
- - (MASConstraint *)baseline;
- #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
- - (MASConstraint *)firstBaseline;
- - (MASConstraint *)lastBaseline;
- #endif
- #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
- - (MASConstraint *)leftMargin;
- - (MASConstraint *)rightMargin;
- - (MASConstraint *)topMargin;
- - (MASConstraint *)bottomMargin;
- - (MASConstraint *)leadingMargin;
- - (MASConstraint *)trailingMargin;
- - (MASConstraint *)centerXWithinMargins;
- - (MASConstraint *)centerYWithinMargins;
- #endif
- - (MASConstraint * (^)(id key))key;
- - (void)setInsets:(MASEdgeInsets)insets;
- - (void)setInset:(CGFloat)inset;
- - (void)setSizeOffset:(CGSize)sizeOffset;
- - (void)setCenterOffset:(CGPoint)centerOffset;
- - (void)setOffset:(CGFloat)offset;
- #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
- @property (nonatomic, copy, readonly) MASConstraint *animator;
- #endif
- - (void)activate;
- - (void)deactivate;
- - (void)install;
- - (void)uninstall;
- @end
- #define mas_equalTo(...) equalTo(MASBoxValue((__VA_ARGS__)))
- #define mas_greaterThanOrEqualTo(...) greaterThanOrEqualTo(MASBoxValue((__VA_ARGS__)))
- #define mas_lessThanOrEqualTo(...) lessThanOrEqualTo(MASBoxValue((__VA_ARGS__)))
- #define mas_offset(...) valueOffset(MASBoxValue((__VA_ARGS__)))
- #ifdef MAS_SHORTHAND_GLOBALS
- #define equalTo(...) mas_equalTo(__VA_ARGS__)
- #define greaterThanOrEqualTo(...) mas_greaterThanOrEqualTo(__VA_ARGS__)
- #define lessThanOrEqualTo(...) mas_lessThanOrEqualTo(__VA_ARGS__)
- #define offset(...) mas_offset(__VA_ARGS__)
- #endif
- @interface MASConstraint (AutoboxingSupport)
- - (MASConstraint * (^)(id attr))mas_equalTo;
- - (MASConstraint * (^)(id attr))mas_greaterThanOrEqualTo;
- - (MASConstraint * (^)(id attr))mas_lessThanOrEqualTo;
- - (MASConstraint * (^)(id offset))mas_offset;
- @end
|