Take the 2-minute tour ×

Is there a way to set the autocapitalizationType for a UITextField so that the first letter of each word is capitalized by default?

This Is An Example Of What I Want

share|improve this question
This is a "read the documentation" question. –  Dancreek Aug 4 '11 at 14:25
On the other hand - it is nice to be able to google 'UITextField capitalization' and have this pop up in 2 seconds, rather than wasting a full minute to open the documentation and scan for this. StackOverflow IS documentation. –  Shaun Budhram Aug 27 '13 at 20:44
add comment

3 Answers

up vote 41 down vote accepted

Use textfield.autocapitalizationType = UITextAutocapitalizationTypeWords;

For more information please read: UITextInputTraits Protocol Reference

share|improve this answer
It doesn't help if you past text to field. In this case delegate text input and replace first letter of each word –  HotJard Dec 10 '13 at 8:17
add comment

Yes. On InterfaceBuilder, on the textField attribute inspector, you can set up the Capitalization property to Words.

share|improve this answer
add comment

Setting the capitalization property to "Words" will suggest that the user enter capitalized words. This can be overridden by the user by un-shifting on the keyboard. The best thing to do is capitalize the words in code:

NSString *text = [myTextField.text capitalizedString];
share|improve this answer
add comment

Your Answer


