Swift

textField.textAlignment = .Center

Objective-C

[textField setTextAlignment: NSTextAlignmentCenter];

In the example, we have set the NSTextAlignment to center. You can also set to .Left, .Right, .Justified and .Natural.

.Natural is the default alignment for the current localization. That means for left-to-right languages (eg. English), the alignment is .Left; for right-to-left languages, it is .Right.