iOS Developer Library — Prerelease

Developer

UIKit Framework Reference UITextInputMode Class Reference

Options
Deployment Target:

On This Page
Language:

UITextInputMode

An instance of the UITextInputMode class represents the current text-input mode. You can use this object to determine the primary language currently being used for text input.

  • Returns an instance representing the current text-input mode.

    Declaration

    Objective-C

    + (UITextInputMode * _Nullable)currentInputMode

    Return Value

    An object representing the current input mode or nil if this object is not set by the text input system.

    Availability

    Available in iOS 4.2 and later.

    Deprecated in iOS 7.0.

  • Returns the active text-input modes.

    Declaration

    Swift

    class func activeInputModes() -> [String]

    Objective-C

    + (NSArray<NSString *> * _Nonnull)activeInputModes

    Discussion

    Each element in the array is an instance of UITextInputMode. Returns an empty array if no such instances have been set by the text input system.

    Availability

    Available in iOS 5.0 and later.

  • The primary language, if any, of the input mode.

    Declaration

    Swift

    var primaryLanguage: String? { get }

    Objective-C

    @property(nonatomic, readonly, strong, nullable) NSString *primaryLanguage

    Discussion

    The value of this property is a BCP 47 language code such as “es”, “en-US”, or “fr-CA”.

    Availability

    Available in iOS 4.2 and later.