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

后端 未结 9 2323
执笔经年
执笔经年 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条回答
  •  旧时难觅i
    2020-11-27 12:11

    First connect the Height constraint in to our viewcontroller for creating IBOutlet like the below code shown

    @IBOutlet weak var select_dateHeight: NSLayoutConstraint!
    

    then put the below code in view did load or inside any actions

    self.select_dateHeight.constant = 0 // we can change the height value
    

    if it is inside a button click

    @IBAction func Feedback_button(_ sender: Any) {
     self.select_dateHeight.constant = 0
    
    }
    

提交回复
热议问题