|
@@ -8,7 +8,7 @@
|
|
#import "MASConstraint.h"
|
|
#import "MASConstraint.h"
|
|
#import "MASConstraint+Private.h"
|
|
#import "MASConstraint+Private.h"
|
|
|
|
|
|
-#define methodNotImplemented() \
|
|
|
|
|
|
+#define MASMethodNotImplemented() \
|
|
@throw [NSException exceptionWithName:NSInternalInconsistencyException \
|
|
@throw [NSException exceptionWithName:NSInternalInconsistencyException \
|
|
reason:[NSString stringWithFormat:@"You must override %@ in a subclass.", NSStringFromSelector(_cmd)] \
|
|
reason:[NSString stringWithFormat:@"You must override %@ in a subclass.", NSStringFromSelector(_cmd)] \
|
|
userInfo:nil]
|
|
userInfo:nil]
|
|
@@ -154,58 +154,88 @@
|
|
return self;
|
|
return self;
|
|
}
|
|
}
|
|
|
|
|
|
-#pragma mark - Abstract
|
|
|
|
|
|
+- (MASConstraint *)and {
|
|
|
|
+ return self;
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint * (^)(CGFloat multiplier))multipliedBy { methodNotImplemented(); }
|
|
|
|
|
|
+#pragma mark - Chaining
|
|
|
|
|
|
-- (MASConstraint * (^)(CGFloat divider))dividedBy { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
|
|
|
|
+ MASMethodNotImplemented();
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint * (^)(MASLayoutPriority priority))priority { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)left {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeft];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (MASConstraint *)top {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTop];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (MASConstraint *)right {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRight];
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)bottom {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottom];
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint *)and { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)leading {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeading];
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint *)left { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)trailing {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailing];
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint *)top { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)width {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeWidth];
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint *)right { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)height {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeHeight];
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint *)bottom { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)centerX {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterX];
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint *)leading { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)centerY {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterY];
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint *)trailing { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)baseline {
|
|
|
|
+ return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBaseline];
|
|
|
|
+}
|
|
|
|
|
|
-- (MASConstraint *)width { methodNotImplemented(); }
|
|
|
|
|
|
+#pragma mark - Abstract
|
|
|
|
|
|
-- (MASConstraint *)height { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint * (^)(CGFloat multiplier))multipliedBy { MASMethodNotImplemented(); }
|
|
|
|
|
|
-- (MASConstraint *)centerX { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint * (^)(CGFloat divider))dividedBy { MASMethodNotImplemented(); }
|
|
|
|
|
|
-- (MASConstraint *)centerY { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint * (^)(MASLayoutPriority priority))priority { MASMethodNotImplemented(); }
|
|
|
|
|
|
-- (MASConstraint *)baseline { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { MASMethodNotImplemented(); }
|
|
|
|
|
|
-- (MASConstraint * (^)(id key))key { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint * (^)(id key))key { MASMethodNotImplemented(); }
|
|
|
|
|
|
-- (void)setInsets:(MASEdgeInsets)insets { methodNotImplemented(); }
|
|
|
|
|
|
+- (void)setInsets:(MASEdgeInsets)insets { MASMethodNotImplemented(); }
|
|
|
|
|
|
-- (void)setSizeOffset:(CGSize)sizeOffset { methodNotImplemented(); }
|
|
|
|
|
|
+- (void)setSizeOffset:(CGSize)sizeOffset { MASMethodNotImplemented(); }
|
|
|
|
|
|
-- (void)setCenterOffset:(CGPoint)centerOffset { methodNotImplemented(); }
|
|
|
|
|
|
+- (void)setCenterOffset:(CGPoint)centerOffset { MASMethodNotImplemented(); }
|
|
|
|
|
|
-- (void)setOffset:(CGFloat)offset { methodNotImplemented(); }
|
|
|
|
|
|
+- (void)setOffset:(CGFloat)offset { MASMethodNotImplemented(); }
|
|
|
|
|
|
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
|
|
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
|
|
|
|
|
|
-- (MASConstraint *)animator { methodNotImplemented(); }
|
|
|
|
|
|
+- (MASConstraint *)animator { MASMethodNotImplemented(); }
|
|
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-- (void)install { methodNotImplemented(); }
|
|
|
|
|
|
+- (void)install { MASMethodNotImplemented(); }
|
|
|
|
|
|
-- (void)uninstall { methodNotImplemented(); }
|
|
|
|
|
|
+- (void)uninstall { MASMethodNotImplemented(); }
|
|
|
|
|
|
@end
|
|
@end
|