NSString * currentWord;
currentWord = Text.text;
UITextChecker* checker = [[UITextChecker alloc] init];
NSString* preferredLanguage = [[UITextChecker availableLanguages] objectAtIndex:0];
NSRange range;
range = [checker rangeOfMisspelledWordInString:currentWord
range:NSMakeRange(0, [currentWord length])
startingAt:0
wrap:NO
language:preferredLanguage];
if (range.location == NSNotFound)
{
NSLog(@"Word found");
}
else
{
NSLog(@"Word not found");
}
//这里我使用了UITextChecker函数,即使是错误的单词,上面的函数也会显示正确的单词语句,例如:abcd,bcde,cdef,CAPs这样的错误单词,请帮助我这是什么原因。有没有其他选择可以解决这个问题?
提前致谢