Vertically align text to top within a UILabel in swift

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 label with longer text that will make more than one line, set numberOfLines to 0(zero here means an unlimited number of lines).

 

myLabel.numberOfLines = 0;
    [myLabel sizeToFit];