从 UITextField 获取自动更正

发布于 2024-12-20 18:12:42 字数 60 浏览 4 评论 0原文

当用户在 UITextField 中输入内容时,如何获取自动更正机制建议的单词?

How can I get the word suggested by the autocorrect mechanism when a user is typing into a UITextField?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

初见 2024-12-27 18:12:42

你不能。没有公共 API 可以查明所提供的建议。

You can't. There is no public API to find out what suggestion is being offered.

阳光的暖冬 2024-12-27 18:12:42

看看 UITextInputTraits,它有一个属性auto CorrectionType

typedef enum {
    UITextAutocorrectionTypeDefault,
    UITextAutocorrectionTypeNo,
    UITextAutocorrectionTypeYes,
} UITextAutocorrectionType;

所以你可以尝试yourTextfield.auto CorrectionType = UITextAuto CorrectionTypeYes;

Take a look at UITextInputTraits, it has a property autocorrectionType

typedef enum {
    UITextAutocorrectionTypeDefault,
    UITextAutocorrectionTypeNo,
    UITextAutocorrectionTypeYes,
} UITextAutocorrectionType;

so you can try yourTextfield.autocorrectionType = UITextAutocorrectionTypeYes;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文