Current location - Health Preservation Learning Network - Healthy weight loss - IOS solves the problem that the estimated value of tableview contensize is inaccurate.
IOS solves the problem that the estimated value of tableview contensize is inaccurate.
I encountered a problem in the development and wanted to add a watermark to the tableview list. So I used tableview.contentsize.height as the height of the watermark. As a result, I found that the height rendering of the watermark was incorrect when sliding, and then I printed the value of tableview.contentsize.height, which was originally estimated and will change with sliding. To turn off the estimate, just set:

table view . estimatedrowheight = 0;

table view . estimatedsectionheaderheight = 0;

table view . estimatedsectionfooterheight = 0;

In iOS 1 1, the table view uses the estimated height by default. This means that contentSize is only an initial estimate. If you need to use contentSize, you can disable the estimated height by setting three estimated height attributes to zero:

table view . estimatedrowheight = 0;

table view . estimatedsectionheaderheight = 0;

table view . estimatedsectionfooterheight = 0;