Created
September 22, 2016 10:34
-
-
Save leilee/a3c157b125916e0205405a0b543f090a to your computer and use it in GitHub Desktop.
change multiplier property for NSLayoutConstraint
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
import UIKit | |
public extension NSLayoutConstraint { | |
func changeMultiplier(multiplier: CGFloat) -> NSLayoutConstraint { | |
let newConstraint = NSLayoutConstraint( | |
item: firstItem, | |
attribute: firstAttribute, | |
relatedBy: relation, | |
toItem: secondItem, | |
attribute: secondAttribute, | |
multiplier: multiplier, | |
constant: constant) | |
newConstraint.priority = priority | |
NSLayoutConstraint.deactivateConstraints([self]) | |
NSLayoutConstraint.activateConstraints([newConstraint]) | |
return newConstraint | |
} | |
} |
Unfortunately, it is not working in tableview cell.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know why, but sometimes it doesn't work in UITableViewCell