UITableView with automatic dimension do no display cells properly. Always the LAST label within that cell is sometimes broken

283 Views Asked by At

Simple case:

Some of my cells are displayed randomly with proper way or not:

  • this is a good way:

enter image description here

  • this is not a good way.

enter image description here

What it depends on, and how to fix it?

Interesting thing:

I added at the end another label:

and now that last label sometimes is not displayed properly. But my previous label now is correct every time. What is going on?

enter image description here

enter image description here

2

There are 2 best solutions below

7
On BEST ANSWER

Make sure:

  1. Lines is set to 0
  2. Line Breaks is set to Character Wrap

If your problem still not solved set preferredMaxLayoutWidth.

0
On

After a big digging, I have found the answer. Automatic dimension is not working well for some UILabel if that label is aligned with different label by top edges or bottom edges. If you get in such bug, just make sure that you do not have such alignment.