Skip to content

Instantly share code, notes, and snippets.

@tLewisII
Created January 14, 2014 03:34
Show Gist options
  • Save tLewisII/8412594 to your computer and use it in GitHub Desktop.
Save tLewisII/8412594 to your computer and use it in GitHub Desktop.
Auto layout macros, for shortening auto layout code.
#define NSConstraintMake(item, itemAttribute, relation, otherItem, otherAttribute, multiplier, constant) \
[NSLayoutConstraint constraintWithItem:item attribute:itemAttribute relatedBy:relatation toItem:otherItem attribute:otherAttribute multiplier:multiplier constant:constant] \
#define kLeading NSLayoutAttributeLeading
#define kTrailing NSLayoutAttributeTrailing
#define kTop NSLayoutAttributeTop
#define kBottom NSLayoutAttributeBottom
#define kCenterX NSLayoutAttributeCenterX
#define kCenterY NSLayoutAttributeCenterY
#define kLeft NSLayoutAttributeLeft
#define kRight NSLayoutAttributeRight
#define kBaseline NSLayoutAttributeBaseline
#define kWidth NSLayoutAttributeWidth
#define kHeight NSLayoutAttributeHeight
#define kNot NSLayoutAttributeNotAnAttribute
#define kEqual NSLayoutRelationEqual
#define kGreaterThanOrEqual NSLayoutRelationGreaterThanOrEqual
#define kLessThanOrEqual NSLayoutRelationLessThanOrEqual
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment