我正在尝试通过 UITextChecker
在 iOS 词典中添加一个词
使用这个:
[UITextChecker learnWord:@"whatishouldadd"];
[UITextChecker hasLearnedWord::@"whatishouldadd"]<--return true
但是,当我启动笔记并键入上面的内容时,它带有红色下划线。
另一个例子:
我尝试使用上面的方法在字典中添加 happizer
。但是,当我发射音符时,会提示 happier
。
我可以知道函数 learnWord
是否真的将工作添加到字典中吗?
最佳答案
根据 UITextChecker
类引用,learnWord ...
"Tells the text checker to learn the specified word so that it is not evaluated as misspelled."
由于您是在应用程序内部创建 UITextChecker
,因此是您的 UITextChecker
正在学习单词,而不是 iPhone
字典整个。因此,应用程序内部教授的单词将无法在全局范围内使用。
关于ios UITextChecker 无法将单词添加到字典中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13390782/