Search code examples
swiftuiviewmoveexpand

How to expand UIView and move other components when expanded


I have a view Controller that contains filter_View

Filter_View

and a tableView_Players

enter image description here .

When I press the button "Filter la recherche"

enter image description here

I want the Filter_View to expand this way

Expanded view

and results moving the tableview down

Tableview moves down .

How to do that ? thanks in advance :)


Solution

  • If you are using AutoLayout, do following :

    1) set vertical spacing from tableView to filterView.

    2) set Height Constraint of filterView and set its outlet.

    3) Initially that height constraint e.g. heightOfFilterview.constant = x

    4) While clicking filter la button set heightOfFilterView.constant = y (Whatever you want).