Sfoglia il codice sorgente

autocapitalize name field in new contact form

Jonas Reinsch 7 anni fa
parent
commit
421840e986
1 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  1. 5 2
      deltachat-ios/CredentialsController.swift

+ 5 - 2
deltachat-ios/CredentialsController.swift

@@ -49,6 +49,7 @@ class TextFieldCell:UITableViewCell {
     static func makeEmailCell() -> TextFieldCell {
         let emailCell = TextFieldCell(description: "Email", placeholder: "you@example.com")
         
+        // this suggests the own email
         emailCell.textField.textContentType = UITextContentType.emailAddress
         emailCell.textField.keyboardType = .emailAddress
         // switch off quicktype
@@ -72,8 +73,10 @@ class TextFieldCell:UITableViewCell {
         
         nameCell.textField.autocapitalizationType = .words
         nameCell.textField.autocorrectionType = .no
-        nameCell.textField.textContentType = UITextContentType.givenName
-        nameCell.textField.keyboardType = .namePhonePad
+        // .namePhonePad doesn't support autocapitalization
+        // see: https://stackoverflow.com/a/36365399
+        // therefore we use .default to capitalize the first character of the name
+        nameCell.textField.keyboardType = .default
         
         return nameCell
     }