Vertically align text to top within a UILabel

Posted in :


這個問題,很奇怪,在 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];


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *