Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. Working with Text > Recipe: Detecting Misspelling in a UITextView

Recipe: Detecting Misspelling in a UITextView

The UITextChecker class provides a way to automatically scan text for misspellings. To use this class, you must first set the target language—for example, en for English, en_US for U.S. English, fr_CA for Canadian French, and so on. The language codes use a combination of ISO 639-1 and optional ISO 3166-1 regions, so while you can choose to use a general English dictionary (en), you can also differentiate between usage in the U.S. (en_US), Australia (en_AU), and the UK (en_GB). Query UITextChecker for an array of availableLanguages from which to pick.

The class also allows you to learn new words (learnWord:) and forget words (unlearnWord:) to customize the onboard dictionary to the user’s need. Learned words are used globally across languages, so when you add a person’s name, that name is available universally. Checker objects can also set words to ignore using instance methods.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial