[ios] UITextField에 대한 iOS 13 제안 (이메일, 전화 번호, 이름…)으로 업데이트 한 후 키보드 위에 나타나지 않습니다

inputField (UITextField)에 대한 iOS 13 입력 제안으로 기기를 업데이트 한 후 이메일, 전화 번호, 이름, 성은 더 이상 키보드 위에 표시되지 않습니다. 첫 번째 이미지 iOS 12.4.1은 이메일을 제안했으며 두 번째 이미지 iOS 13.1.2는 제안이 없습니다. 동일한 데모 앱이 iPhone 7 iOS 12.4.1 (첫 번째 이미지, 예상대로 작동)에서 xCode 버전 11.0 (11A419c)으로 빌드됩니다. iPhone 7 iOS 13.1.2 (두 번째 이미지, 키보드 위에 제안 사항 없음) 스토리 보드에 textContentType을 추가하고 코드에서 다음 줄을 직접 추가하여 테스트했습니다.

email.textContentType = .emailAddress

iOS 12.4.1에서 예상대로 계속 작동

iOS 13.1.2는 제안을 표시하지 않습니다



답변

따라서 iOS 13 이상에서는 다음 속성을 설정하면 iPhone에서 모든 데이터를 제안합니다.

이메일의 경우이 세 가지 속성이 모두 설정되어 있는지 확인하십시오.

 emailField.autocorrectionType = .yes
 emailField.textContentType = .emailAddress
 emailField.keyboardType = .emailAddress

이름과 성의 경우 :

firstNameField.autocorrectionType = .yes
firstNameField.textContentType = .givenName
firstNameField.keyboardType = .namePhonePad

lastNameField.autocorrectionType = .yes
lastNameField.textContentType = .familyName
lastNameField.keyboardType = .namePhonePad

전화 번호의 경우 조금 까다 롭습니다.

phoneField.autocorrectionType = .yes
phoneField.textContentType = .telephoneNumber
phoneField.keyboardType = .numbersAndPunctuation

또한 장치의 키보드 설정 에서 예측 켜져 . 경우 가 작동하지 않습니다 에 한 번 떨어져 켤 몇 초 동안 대기 한 후 다시 켜 과 다시 일하게 될 것 붐.

그것이 도움이되기를 바랍니다!


답변