如何检查文本视图中输入的拼写?
我有一个 UITextview,用户在其中输入文本。之后,我将该文本作为字符串并将其显示在另一个文本视图中,并想要语法不正确的单词。
怎么做呢?
I have one UITextview in which user enter text. after that i take that text as a string and display it in another textview and want the words which are grammatically incorrect.
How to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用自 ios 3.2 起可用的 UITextChecker 类: 苹果文档
Use the UITextChecker class that's been available since ios 3.2: Apple Documentation
iOS系统仅在用户输入文本时提供拼写检查。如果用户选择输入错误的单词,iOS 将无法提供帮助。如果您想执行自己的拼写检查,则必须包含您自己的拼写检查库。
GNU Aspell 是一个自由开源的拼写检查器,旨在最终取代 Ispell。它既可以用作库,也可以用作独立的拼写检查器。
iPhone 上的 Aspell 拼写检查器? 几年前在这里被问到。我不确定他们是否成功了。
iOS system only provide spell checking while the user is inputting text. If the user choose to type in the wrong word or words, iOS cannot help. If you want to perform your own spell checking, you will have to include your own spell checking library.
GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell. It can either be used as a library or as an independent spell checker.
Aspell Spell Checker on iPhone? was asked a few years ago here on SO. I am not sure if they ever got it working.
使用由
UITextView
实现的UITextInputTraits
协议的auto CorrectionType
属性使用如下
禁用
myTxtview。自动更正类型 = UITextAuto CorrectionTypeNo
;启用
myTxtview.auto CorrectionType = UITextAuto CorrectionTypeYes
;在苹果文档中
Use
autocorrectionType
property ofUITextInputTraits
protocol which is implemented byUITextView
Use it as below
To disable
myTxtview.autocorrectionType = UITextAutocorrectionTypeNo
;To enable
myTxtview.autocorrectionType = UITextAutocorrectionTypeYes
;In Apple Documentation
您可以使用Interface Builder在
TextField
属性中的文本输入特征下使用更正选项。它将处理有效的英语单词。You can use Correction option under Text Input Traits in
TextField
Attributes using Interface Builder. It will take care of Valid English words.