Closed dimovskidamjan closed 6 years ago
That's because you're setting up your cell's layout incorrectly. The flow layout itself can handle multi-line labels without any problem.
💡 The trick with multi-line labels (numberOfLines = 0
) in general is that you somehow need to tell them what their maximum width should be. How else would a multi-line label decide when to break into a new line?
There are two ways to achieve this:
label.width <= 140
(pseudocode).preferredMaxLayoutWidth
manually to that value.You can do both things in Interface Builder if you want.
@mischa-hildebrand Thanks! Just wanted to confirm that I tried these and it works as expected with either of the proposed solutions. I knew I was missing something :)
Awesome! I'm happy to hear that! 🙃
If you enter a longer string, even in your example project, in one of the cells, the whole layout breaks and none of the cells are loaded. Is there a way to provide support for multi-line labels which would resize the cell dynamically not only by width as it does now but by height also?