Class: UITextChecker

Inherits:
NSObject show all

Overview

You use instances of the UITextChecker class to check a string (usually the text of a document) for misspelled words.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Class Method Details

+ (Array) availableLanguages

Returns the languages for which the text checker’s class can perform spell-checking. The languages represented by the strings in the returned array are in user-preference order.

Returns:

  • (Array)

    An array of strings representing ISO 639-1 language codes or combined ISO 639-1 language codes and ISO 3166-1 regional codes (for example, en_US).

+ (Boolean) hasLearnedWord(word)

Returns whether the text checker has learned the specified word.

Parameters:

  • word (String)

    A string representing a word.

Returns:

  • (Boolean)

    YES if the class has learned the word, otherwise NO.

+ (Object) learnWord(word)

Tells the text checker to learn the specified word so that it is not evaluated as misspelled. When a UITextChecker object learns a word, it is added to the dictionary. It is global across languages.

Parameters:

  • word (String)

    A string representing the word for the class to learn.

Returns:

+ (Object) unlearnWord(word)

Tells the text checker to unlearn the specified word When a UITextChecker object unlearns a word, it is removed from the dictionary.

Parameters:

  • word (String)

    A string representing the word for the class to unlearn.

Returns:

Instance Method Details

- (Array) completionsForPartialWordRange(range, inString:string, language:language)

Returns an array of strings that are possible completions for a partially entered word. The strings in the array are in the order they should be presented to the user—that is, more probable completions come first in the array.

Parameters:

  • range (NSRange)

    The range of a partially entered word in string.

  • string (String)

    A string in which there is a partially entered word, as located by range.

  • language (String)

    The language of the of the words that are possible corrections. This string is a ISO 639-1 language code or a combined ISO 639-1 language code and ISO 3166-1 regional code (for example, fr_CA).

Returns:

  • (Array)

    An array of strings, each of which is a completion of a partially entered word represented by range in string. If no possible completions are found, the method returns an empty array.

- (Array) guessesForWordRange(range, inString:string, language:language)

Returns a list of words that are possible valid replacements for a misspelled word. The strings in the array are in the order they should be presented to the user—that is, more probable guesses come first in the array.

Parameters:

  • range (NSRange)

    The range of a misspelled word in string.

  • string (String)

    A string in which there is a misspelled word, as located by range.

  • language (String)

    The language of the of the words that are possible corrections. This string is from the ISO 639-1 standard, for example es (Spanish).

Returns:

  • (Array)

    An array of strings each of which might be a correct substitute (that is, a guess) for a misspelled word in the given range of the string. If no possible guesses are found, the method returns an empty array.

- (Array) ignoredWords

Returns the words that the receiver ignores when spell-checking. The spell checker excludes ignored words as misspelled words during the current spell-checking session only.

Returns:

  • (Array)

    An array of strings, each of which specifies a word the receiver ignores when it is spell-checking a document.

- (Object) ignoreWord(wordToIgnore)

Tells the receiver to ignore the specified word when spell-checking. The spell checker excludes ignored words as misspelled words during the current spell-checking session only.

Parameters:

  • wordToIgnore (String)

    A string that is a word the receiver should ignore when it is spell-checking a document.

Returns:

- (NSRange) rangeOfMisspelledWordInString(stringToCheck, range:range, startingAt:startingOffset, wrap:wrapFlag, language:language)

Initiates a search of a range of a string for a misspelled word. To search an entire string or a range within that string, call this method in a loop, resetting startingOffset from each returned range, until you reach the end of the string or specified range within the string.

Parameters:

  • stringToCheck (String)

    The string to check for misspelled words.

  • range (NSRange)

    The range of stringToCheck to check for a misspelled word.

  • startingOffset (Integer)

    The offset within range of stringToCheck to begin checking for misspelled words.

  • wrapFlag (Boolean)

    YES to continue checking from the beginning of range if no misspelled word is found between startingOffset and the end of range. Specify NO to have spell-checking end at the end of range.

  • language (String)

    The language of the of words to be checked for correct spelling. This string is a ISO 639-1 language code or a combined ISO 639-1 language code and ISO 3166-1 regional code (for example, fr_FR).

Returns:

  • (NSRange)

    The range of the first misspelled word encountered or 0 if none is found.

- (Object) setIgnoredWords(words)

Sets the list of words that the receiver should ignore when it is spell-checking a document. Ignored words are not treated as misspelled words only for the current spell-checking session.

Parameters:

  • words (Array)

    An array of strings, each of which specifies a word the receiver should ignore when it is spell-checking a document.

Returns: