Vertically align text to top within a UILabel
问题 I have a UILabel with space for two lines of text. Sometimes, when the text is too short, this text is displayed in the vertical center of the label. How do I vertically align the text to always be at the top of the UILabel ? 回答1: There's no way to set the vertical-align on a UILabel , but you can get the same effect by changing the label's frame. I've made my labels orange so you can see clearly what's happening. Here's the quick and easy way to do this: [myLabel sizeToFit]; If you have a