文字对齐

迅速

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

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

Objective-C

label.textAlignment = NSTextAlignmentLeft;

NSTextAlignment 枚举中的任何值均有效:NSTextAlignmentLeftNSTextAlignmentCenterNSTextAlignmentRightNSTextAlignmentJustifiedNSTextAlignmentNatural

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