我们可以改变NSLayoutConstraint的常量属性,而不是使用UIView动画块来进行动画更改.
myLayoutConstraint.constant = 50;
[UIView animateWithDuration: .3 animations:^{
[view layoutIfNeeded];
}];
Run Code Online (Sandbox Code Playgroud)
但是,视图的子视图(具有布局约束作为其超级视图)将被设置为动画!它们将从原始零帧动画到自动布局的目标帧.如何解决这个问题呢?
rou*_*nak 12
这表明您有待处理的布局操作.layoutIfNeeded之前打过电话
myLayoutConstraint.constant = 50;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2106 次 |
| 最近记录: |