使用 LayoutConstraints 只是为了改变方向?

Using LayoutConstraints just for orientation changes?

当我使用 Storyboard 为按钮位置等添加约束时,我在方向更改时获得了超级平滑的过渡。按钮移动到各自的新位置。

但我使用 view.translatesAutoresizingMaskIntoConstraints = true 在屏幕上移动元素。

现在我几乎要开始为方向变化编写自定义动画逻辑了。但必须有一些更简单的方法!?我可以在方向改变之前打开约束并在之后再次解除约束吗?

我尝试使用以下方法使我的项目 'stick' 位于屏幕底部,但没有成功。

NSLayoutConstraint(item: super.bottomLayoutGuide, attribute: .Top, relatedBy: .Equal, toItem: self.centerPositionButton, attribute: NSLayoutAttribute.Bottom, multiplier: 1.0, constant: 20)

我目前正在尝试很多东西,但有件事告诉我,我不能成为第一个尝试这个的人。

为此使用 NSLayoutConstraints 似乎是正确的方法。 谢谢 gnasher729 指出我只是用错了。