1 image
Author
Description
A UIView category to make autolayout (more) readable and less verbose. Write this:
[view lyt_centerInParent];
Instead of:
NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint
constraintWithItem:view attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual toItem:view.superview
attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0];
[view.superview addConstraint:centerXConstraint];
NSLayoutConstraint *centerYConstraint = [NSLayoutConstraint
constraintWithItem:view
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual toItem:view2
attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0];
[view.superview addConstraint:centerYConstraint];