'UIScrollview height won't change programatically in swift

Try to change scrollview height, but it doesn't work programatically

@IBOutlet weak var containerView : UIScrollView!

public override func viewDidAppear(_ animated: Bool) {
    self.containerView.frame = CGRect(x: 0, y: 0, width: containerView.frame.width, height: UIScreen.main.bounds.height / 2)
}

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source