如何触发所有自动布局约束的更新?

问题描述:

我以编程方式修改了一个自动布局约束。它对某个特定视图生效,但与该视图的其他约束绑定的其他视图不会更改其位置。是否有 updateAllConstraints 方法?

I modified programmatically one autolayout constraint. It takes effect on one certain view, but other views that are bound with other constraints to that view, do not change their positions. Is there an "updateAllConstraints" method?

问题是约束没有正确设置,在这种情况下,setNeedsLayout或updateConstraintsIfNeeded的非帮助。

The problem was that constrains were not set up properly, and in this case non of the setNeedsLayout or updateConstraintsIfNeeded can help.