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.
精彩评论