I have two interface layout restrictions that conflict with each other in design. Only one of them can be active at a time.
In the UIViewController'smethod updateConstraintsIfNeeded, I have the following code that switches between two constraints, depending on the state of the data model.
override func updateConstraintsIfNeeded() {
super.updateConstraintsIfNeeded()
if question?.thumbURL != nil {
showAttachmentConstraint.active = true
hideAttachmentConstraint.active = false
} else {
showAttachmentConstraint.active = false
hideAttachmentConstraint.active = true
}
}
This work is as intended, but I received this familiar warning on debug output.
Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. ...
Apparently, when the statement is executed showAttachmentConstraint.active = true, it temporarily conflicts with hideAttachmentConstraintwhich is still active at this time.
Is it possible to do this atom switching operation? I hope there is something like beginUpdateand endUpdatein UITableView.