iOS Development – sizeToFit:

Jérémy Chatard explains the intricacies of UIView’s sizeToFit: with a concrete example of how it should be used to lay out a bunch of subviews stacked vertically. He makes use of recursion in his solution to solve the problem of “If you want to lay out a parent view, you first need to lay out its children”.

If, like me, you always wondered what sizeToFit: should be used for, I recommend you read this. Cheers Jérémy.

One Comment

  • Phi Dinh wrote:

    I found it especially useful for creating my own rich text labels (lots of sub labels with individual styling positioned in a left to right flow using sizetofit)

Leave a Reply

Your email is never shared.Required fields are marked *