Open liuruxian opened 8 years ago
what type is viewHeight? Double etc. won't work it needs to be a CGFloat. You could try
view.height == CGFloat(viewHeight)
I was having similar issue, you have to store the original constraints inside of a ConstraintGroup. Then re-state all of the constraints + the one you want updated. Like this: ` let group = constrain(self.bgView!, self.introduce!) { (view1, view2) in view1.height == 20 view1.left == view1.superview!.left+10 view1.right == view1.superview!.right-10 view1.top == view1.superview!.top+10
view2.left == view1.left
view2.right == view1.right
view2.top == view1.bottom + 10
view2.bottom == view2.superview!.bottom - 10
}`
Then: ` constrain(self.bgView!, self.introduce!, replace: group) { (view1, view2) in view1.height == 80 view1.left == view1.superview!.left+10 view1.right == view1.superview!.right-10 view1.top == view1.superview!.top+10
view2.left == view1.left
view2.right == view1.right
view2.top == view1.bottom + 10
view2.bottom == view2.superview!.bottom - 10
}`
before change the height constrain you need to replace the old one
I use Cartography to layout my cell, But how can I get change the view of height with contrain
and then , the bgview of height will be changed code: constrain(self.bgView!) { view in let viewHeight:CGFloat = 80 view.height == viewHeight }
it recevie the layout of error