UITextView custom spelling and autocorrect

主宰稳场 提交于 2021-01-27 02:56:16

问题


I want to make an iOS text editor for a certain rare human language, and I want it to support my own spell checking and autocorrect systems for that language.

In iOS, is it possible to get UITextView to use a custom spell checker and autocorrect system, rather than those of the system's current locale? Or do I have to resort to creating a text view from scratch using Core Text?


回答1:


I don’t think there’s a way to actually change the spell-checking mechanism of UITextView.

A good approach would be to set your UITextView’s spellCheckingType to UITextSpellCheckingTypeNo, so system spell checking is disabled—then use an attributed string to draw the spell error marker on the text yourself, using your own spell-checking class/engine to find spelling errors.

Have a look at this answer on how to use attributed strings.



来源:https://stackoverflow.com/questions/7762476/uitextview-custom-spelling-and-autocorrect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!