从 UITextField 获取自动更正
当用户在 UITextField
中输入内容时,如何获取自动更正机制建议的单词?
How can I get the word suggested by the autocorrect mechanism when a user is typing into a UITextField
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你不能。没有公共 API 可以查明所提供的建议。
You can't. There is no public API to find out what suggestion is being offered.
您可以使用
UITextChecker
类:https://developer.apple.com/库/iOS/#documentation/UIKit/Reference/UITextChecker_Class/Reference/Reference.html
You can use the
UITextChecker
class :https://developer.apple.com/library/iOS/#documentation/UIKit/Reference/UITextChecker_Class/Reference/Reference.html
看看
UITextInputTraits
,它有一个属性auto CorrectionType
,所以你可以尝试
yourTextfield.auto CorrectionType = UITextAuto CorrectionTypeYes;
Take a look at
UITextInputTraits
, it has a propertyautocorrectionType
so you can try
yourTextfield.autocorrectionType = UITextAutocorrectionTypeYes;