Created
June 14, 2014 13:12
-
-
Save SuperY/3e9321abb43b5f6be36c to your computer and use it in GitHub Desktop.
UITableViewCell Editing with Autolayout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)awakeFromNib | |
{ | |
[super awakeFromNib]; | |
for (NSLayoutConstraint *cellConstraint in self.constraints) | |
{ | |
[self removeConstraint:cellConstraint]; | |
id firstItem = cellConstraint.firstItem == self ? self.contentView : cellConstraint.firstItem; | |
id seccondItem = cellConstraint.secondItem == self ? self.contentView : cellConstraint.secondItem; | |
NSLayoutConstraint* contentViewConstraint = [NSLayoutConstraint constraintWithItem:firstItem | |
attribute:cellConstraint.firstAttribute | |
relatedBy:cellConstraint.relation | |
toItem:seccondItem | |
attribute:cellConstraint.secondAttribute | |
multiplier:cellConstraint.multiplier | |
constant:cellConstraint.constant]; | |
[self.contentView addConstraint:contentViewConstraint]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment