Search code examples
iosswiftuitableviewuitableviewautomaticdimension

Hiding UI elements in UITableViewCell and resize cell according


What is the best approach to hide UI elements in a UITableView with UITableViewAutomaticDimension?

I have multiple labels, buttons, imageviews in a cell. For specific condition I want to hide some of them and want the tableview to resized accordingly.

Kindly correct me if I'm missing something.


Solution

  • Use StackView.

    StackView will manage it, when elements hide they resize automatically. use StackView in tableview cell

    Click Here for how to use StackView

    Click Here For Example, This will help you to more understand.