文字对齐

迅速

label.textAlignment = NSTextAlignment.left 
//or the shorter
label.textAlignment = .left 

NSTextAlignment 枚举中的任何值都有效:.left,.center,.right,.justified,.natural

Objective-C

label.textAlignment = NSTextAlignmentLeft;

NSTextAlignment 枚举中的任何值均有效:NSTextAlignmentLeft,NSTextAlignmentCenter,NSTextAlignmentRight,NSTextAlignmentJustified,NSTextAlignmentNatural

开箱即用不支持 UILabel 中的垂直对齐 : 在 UILabel中垂直对齐文本