更新到iOS 13后,UITextField的建议(电子邮件,电话号码,名字...)不会出现在键盘上方 [英] After updating to iOS 13 suggestion(email, phone number, first name...) for UITextField don't appear above keyboard

查看:113
本文介绍了更新到iOS 13后,UITextField的建议(电子邮件,电话号码,名字...)不会出现在键盘上方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将设备更新到iOS 13之后,为inputField(UITextField)输入建议.像电子邮件,电话号码,名字,姓氏都不再出现在键盘上方.第一个映像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以及直接在代码中添加下一行进行测试

After updating device to iOS 13 input suggestion for inputField(UITextField). Like email, phone number, first name, last name don't appear above keyboard anymore. First image iOS 12.4.1 have suggested email, second image iOS 13.1.2 don't have any suggestion. Same demo app is build with xCode Version 11.0 (11A419c) on iPhone 7 iOS 12.4.1(first image, work as expected). iPhone 7 iOS 13.1.2(second image, don't have any suggestion above keyboard) I tested by adding textContentType in storyboard and also by adding next line in code directly

email.textContentType = .emailAddress

推荐答案

因此对于iOS 13(或更高版本),我注意到设置以下属性使iPhone可以建议您所有数据:

So for iOS 13 (or higher), I noticed that setting the following properties makes iPhone to suggest you all the data:

对于电子邮件,请确保已设置所有这三个属性:

 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

还请确保设备的键盘设置中的预测性已打开.如果一次不起作用,请将其关闭,等待几秒钟,然后再次打开,然后重新启动它.

Also make sure that Predictive in Keyboards Setting of device is turned on. If it doesn't work at once turn it off wait for a few seconds and then turn on again and boom it would be working again.

希望有帮助!

这篇关于更新到iOS 13后,UITextField的建议(电子邮件,电话号码,名字...)不会出现在键盘上方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆