0

I am trying to create a Table View Cell that has three pronounced regions. The top region is conditional so it doesn't always show. The Middle region is my main region where general information is. The Middle region can be clicked and that expands/shows the bottom region aka show more, show less functionality.

All regions heights need to be auto sized based on their contents.

What I tough of doing is making each region a separate UIView. And when I need to hide top or bottom region I just constrain their width to 0.

I need to know if all this would be possible with auto layout as I have never used it. Is this the correct way of doing it?

enter image description here

h3dkandi
  • 1,106
  • 1
  • 12
  • 27
  • If all three `UIView` has its contents in your xib then you can easily do `autolayout` for every view based on their contents, you don't need to calculate anything for that. @h3dkandi – iPeter May 11 '17 at 09:20

2 Answers2

3

Yes it is possible. take a look at this link it should answer all your questions.

Community
  • 1
  • 1
Darshan Karekar
  • 681
  • 3
  • 16
0

You should use UITableViewAutomaticDimension. You can also refer this link it matches your requirement

Anand Yadav
  • 479
  • 5
  • 17