UILabel Align Text to center

vivianaranha picture vivianaranha · Apr 19, 2011 · Viewed 201.9k times · Source

How do I align text in UILabel?

Answer

Aravindhan picture Aravindhan · Jul 12, 2012

From iOS 6 and later UITextAlignment is deprecated. use NSTextAlignment

myLabel.textAlignment = NSTextAlignmentCenter;

Swift Version from iOS 6 and later

myLabel.textAlignment = .center