Tuesday, 1 October 2013

Why does sizeToFit not work when trying to vertically align my UILabel? It just stays in the center

Why does sizeToFit not work when trying to vertically align my UILabel? It
just stays in the center

I was reading this post for advice on how to vertically align text within
a UILabel, and the top comment seemed to present a great solution.
I have my UILabel, and I set number of lines to 0. Then in viewDidLoad for
the View Controller it's a part of, I called sizeToFit on it, but it still
only occupies the middle.
It looks like this in Interface Builder:

And looks the exact same when I run it, the text is still really far away
from the navigation bar when I'd prefer it to be very close, preferably at
the top of that outline box.
What am I doing wrong?

No comments:

Post a Comment