Follow these steps to set auto layout constraints:
1) To bottomView :
heightconstraints to bottomView with respect to parent view
2) To UITableView :
top constraints to tableView with respect to parent view.
bottom constraint to tableview with bottomView which is below tableview.
3) Select the
height constraint of bottomView from storyboard's constraint hierarchy, and take an outlet for it:
@IBOutlet weak var heightConstraint: NSLayoutConstraint!
4) In the method, where you are hiding your bottomView, just change the value of it's height constraint to zero like:
bottomView.isHidden = true heightConstraint.constant = 0 view.updateConstraintsIfNeeded()
Hope this helps you