I have a text box and I am only interested in capitalizing the first letter, So how to do that in iPhone UITextField.
Asked
Active
Viewed 4.0k times
6 Answers
117
try this:
tf = [[UITextField alloc] init];
tf.autocapitalizationType = UITextAutocapitalizationTypeSentences;
or set this property in the properties inspector in Interface Builder

Sunil Targe
- 7,251
- 5
- 49
- 80

ennuikiller
- 46,381
- 14
- 112
- 137
47
Swift 3 :
textField.autocapitalizationType = .sentences
textField.autocapitalizationType = .words
textField.autocapitalizationType = .allCharacters
Output :
- Sentences : This is text input.
- Words : This Is Text Input.
- All characters : THIS IS TEXT INPUT.

Jonathan Cabrera
- 1,656
- 1
- 19
- 20

Ketan P
- 4,259
- 3
- 30
- 36
22
In the Attributes Inspector, near the bottom of the Text Field section, there is a setting called Capitalization
with a drop down menu. Here, you can select Words
, Sentences
, or All Characters
.

jungledev
- 4,195
- 1
- 37
- 52
6
In the Attributes Inspector , there is a Capitalization with a drop down menu. Here, you can select Words, Sentences, or All Characters.
- Word : if you select Word than first character of every word is Capital
- Sentences : if you Sentence than first character of First word of every sentence is Capital
- All Characters : All Characters are Capital

Nipul Daki
- 371
- 1
- 3
- 17
3
Select your text field ,go in interface builder(properties option) storyboard there is a option Capatalization set it to sentence.enjoy!!!

M.Hamza
- 49
- 1