How to update the constant height constraint of a UIView programmatically?

后端 未结 9 2293
执笔经年
执笔经年 2020-11-27 11:16

I have a UIView and I set the constraints using Xcode Interface Builder.

Now I need to update that UIView instance\'s height constant progra

9条回答
  •  自闭症患者
    2020-11-27 11:52

    To update a layout constraint you only need to update the constant property and call layoutIfNeeded after.

    myConstraint.constant = newValue
    myView.layoutIfNeeded()
    

提交回复
热议问题