I am working on a simple application, and now I am focused on extending the UITableViewCell after the user has touched this cell. This is an iOS 8 application, so I installed:
self.tableVIew.rowHeight = UITableViewAutomaticDimension self.tableVIew.estimatedRowHeight = 50
cell restrictions are as follows:

If the custom responder cell calls this function:
func extend() { self.contentView.removeConstraint(self.bottomConstraint) let additionalView = UIView() additionalView.setTranslatesAutoresizingMaskIntoConstraints(false) additionalView.backgroundColor = UIColor.orangeColor() self.contentView.addSubview(additionalView) self.contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:[additionalView(50)]-5-|", options: nil, metrics: nil, views: ["additionalView" : additionalView])) self.contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-5-[additionalView(100)] -5@999- |", options: nil, metrics: nil, views: ["additionalView" : additionalView])) }
self.bottomConstraint is the price between the bottom of the green circle and the contents of the content below.
Question: Why does this solution only work if the restriction has priority:
V:|-5-[additionalView(100)] -5@999- |
?
Without an explicit priority, I got errors:
( "<NSLayoutConstraint:0x7a63f7a0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7a737840(60)]>", "<NSLayoutConstraint:0x7a644f40 V:|-(5)-[UIView:0x7a63f2a0] (Names: '|':UITableViewCellContentView:0x7a737840 )>", "<NSLayoutConstraint:0x7a644fb0 V:[UIView:0x7a63f2a0(100)]>", "<NSLayoutConstraint:0x7a644f70 V:[UIView:0x7a63f2a0]-(5)-| (Names: '|':UITableViewCellContentView:0x7a737840 )>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x7a644f70 V:[UIView:0x7a63f2a0]-(5)-| (Names: '|':UITableViewCellContentView:0x7a737840 )>
source share