Nil*_*ari 22 objective-c ios xcode-storyboard
我有一个屏幕.它将显示如下
现在当用户点击我有一个帐户和密码(按钮)时,它将显示如下
我想相应地移动两个视图我使用storyboard添加了约束.现在需要从编程中改变约束.
Car*_*Zyl 45
然后在代码中设置约束的常量值:
labelWidthConstraint.constant = newValue
Run Code Online (Sandbox Code Playgroud)
如果你想要它的动画,你可以做这样的事情:
labelWidthConstraint.constant = newValue
UIView.animate(withDuration: 0.3, animations: {
self.view.layoutIfNeeded()
})
Run Code Online (Sandbox Code Playgroud)
self.labelWidthConstraint.constant = newValue;
[UIView animateWithDuration:0.3 animations:^{
[self.view layoutIfNeeded];
}];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16030 次 |
| 最近记录: |