vivianaranha vivianaranha - 1 year ago 183
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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download