开发者

How to Align Label Text to the Top

I have a label in a UIScrollView that gets its string contents from a website. I was wondering how to make the label display the text so开发者_JS百科 that it is not centered, but is top aligned. The text in the label keeps displaying in the center of the label, which looks awkward in a scroll view. I want the label to display the text starting from the top. Thanks!


Call -sizeToFit on this label after setting it's text. If all you have in this scrollview is a label, you could also adjust it's contentSize after that.


If you use auto layout, you need to adjust your constraint of height to "Less than or equals" and update your constant to the maximum you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜