vivianaranha vivianaranha - 26 days ago 19
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
Comments