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 thought on “iOS Development – sizeToFit:

  1. 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 address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>