Snigdha Gayatri
Snigdha Gayatri

Reputation: 57

How to shrink the size of a row in a tableview after a label in that cell is hidden?

I have used UITableViewAutomaticDimension but I want the tableview not to show the space where the label is hidden.

Upvotes: 1

Views: 162

Answers (1)

Ketan Parmar
Ketan Parmar

Reputation: 27448

If you are using UITableViewAutomaticDimension then you should make height of label 0 instead of hiding it so it will automatically change cell's height.

Now for make label's height 0 when you are using autolayout, you need to set outlet of your height constraint of your label.

Then set constant of that heightConstraintOutlet to zero instead of hiding and set it with desired value instead of showing it!!

Upvotes: 1

Related Questions