0

I have a button which presents an alert with a text field in it. When clicked on the button it automatically focuses in the text field and keyboard shows. However the letters in the keyboard start as lower-case. How can I fix that so it starts as upper-case?

Edit:

alertTextField.autocapitalizationType = .sentences

This was what I was looking for.

pacification
  • 5,838
  • 4
  • 29
  • 51
  • 1
    See https://stackoverflow.com/questions/45310261/swift3-uitextfield-in-uialert-validation-after-button-pressed for an example. – rmaddy Aug 31 '18 at 13:56

1 Answers1

0

Try this

let mytextfield = UITextField()
mytextfield.autocapitalizationType = .allCharacters

Other types :

enter image description here

dahiya_boy
  • 9,298
  • 1
  • 30
  • 51