vivianaranha vivianaranha - 9 months ago 117
iOS Question

UILabel Align Text to center

How do I align text in

UILabel
?

Answer Source

From iOS 6 and later UITextAlignment is deprecated. use NSTextAlignment

myLabel.textAlignment = NSTextAlignmentCenter;

Swift Version from iOS 6 and later

myLabel.textAlignment = NSTextAlignment.center