vivianaranha vivianaranha - 11 months ago 132
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