1. 程式人生 > >Vertically align text to top within a UILabel

Vertically align text to top within a UILabel

這個問題,很奇怪,在 storyboard 裡找不到屬性去設定。

透過程式去調,一設就成功了。用 sizeToFit.

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
];