Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (28 sloc) 1.46 KB
#import <Foundation/Foundation.h>
#define SCAddConstraints(__constraintBlock) [[SCConstraintCoordinator instance] addConstraintsInBlock:^__constraintBlock]
#define SCAddConstraint(__constraint) [[SCConstraintCoordinator instance] addConstraintInBlock:^{__constraint;}]
#define SCFlex() [[SCConstraintCoordinator instance] currentFlexValue]
@interface SCConstraintCoordinator : NSObject
+ (SCConstraintCoordinator *)instance;
- (void)recordAccessOfAttribute:(enum NSLayoutAttribute)attribute fromView:(UIView *)view;
- (CGFloat)currentReturnValue;
- (CGFloat)currentFlexValue;
- (void)setConstraintForAttribute:(enum NSLayoutAttribute)attribute onView:(UIView *)view value:(CGFloat)value;
- (NSArray *)addConstraintsInBlock:(void (^)())block;
- (NSLayoutConstraint *)addConstraintInBlock:(void (^)())block;
- (UIView *)firstCommonAncestorOfView:(UIView *)view1 andView:(UIView *)view2;
@end
@interface UIView (SimpleConstraint)
//basic
@property (nonatomic, assign) CGFloat sc_left;
@property (nonatomic, assign) CGFloat sc_right;
@property (nonatomic, assign) CGFloat sc_top;
@property (nonatomic, assign) CGFloat sc_bottom;
@property (nonatomic, assign) CGFloat sc_centerX;
@property (nonatomic, assign) CGFloat sc_centerY;
@property (nonatomic, assign) CGFloat sc_width;
@property (nonatomic, assign) CGFloat sc_height;
@property (nonatomic, assign) CGFloat sc_leading;
@property (nonatomic, assign) CGFloat sc_trailing;
@property (nonatomic, assign) CGFloat sc_baseline;
@end