vivianaranha vivianaranha - 7 months ago 112
iOS Question

UILabel Align Text to center

How do I align text in

UILabel
?

Answer

From iOS 6 and later UITextAlignment is deprecated. use NSTextAlignment

myLabel.textAlignment = NSTextAlignmentCenter;

Swift Version from iOS 6 and later

myLabel.textAlignment = NSTextAlignment.center