Protocol: UITextInputTraits
Overview
The UITextInputTraits protocol defines features that are associated with keyboard input. All objects that support keyboard input must adopt this protocol in order to interact properly with the text input management system. The UITextField and UITextView classes already support this protocol.The auto-capitalization style for the text object. (required)The auto-correction style for the text object. (required)A Boolean value indicating whether the return key is automatically enabled when text is entered by the user. (required)The appearance style of the keyboard that is associated with the text object (required)The keyboard style associated with the text object. (required)The contents of the “return” key. (required)Identifies whether the text object should hide the text being entered. (required)The spell-checking style for the text object. (required)The auto-capitalization behavior of a text-based view. The auto-correction behavior of a text-based view. The spell-checking behavior of a text-based view.The type of keyboard to display for a given text-based view.The appearance of the keyboard used by a text-based view.The text string displayed in the “return” key of a keyboard.
Instance Attribute Summary (collapse)
-
- autocapitalizationType
The auto-capitalization style for the text object.
-
- autocorrectionType
The auto-correction style for the text object.
-
- enablesReturnKeyAutomatically
A Boolean value indicating whether the return key is automatically enabled when text is entered by the user.
-
- keyboardAppearance
The appearance style of the keyboard that is associated with the text object (required) This property lets you distinguish between the default text entry inside your application and text entry inside an alert panel.
-
- keyboardType
The keyboard style associated with the text object.
-
- returnKeyType
The contents of the “return” key.
-
- secureTextEntry
Identifies whether the text object should hide the text being entered.
-
- spellCheckingType
The spell-checking style for the text object.
Instance Attribute Details
- (UITextAutocapitalizationType) autocapitalizationType
The auto-capitalization style for the text object. (required) This property determines at what times the Shift key is automatically pressed, thereby making the typed character a capital letter. The default value for this property is UITextAutocapitalizationTypeSentences. Some keyboard types do not support auto-capitalization. Specifically, this option is ignored if the value in the keyboardType property is set to UIKeyboardTypeNumberPad, UIKeyboardTypePhonePad, or UIKeyboardTypeNamePhonePad.
- (UITextAutocorrectionType) autocorrectionType
The auto-correction style for the text object. (required) This property determines whether auto-correction is enabled or disabled during typing. With auto-correction enabled, the text object tracks unknown words and suggests a more suitable replacement candidate to the user, replacing the typed text automatically unless the user explicitly overrides the action. The default value for this property is UITextAutocorrectionTypeDefault, which for most input methods results in auto-correction being enabled.
- (Boolean) enablesReturnKeyAutomatically
A Boolean value indicating whether the return key is automatically enabled when text is entered by the user. (required) The default value for this property is NO. If you set it to YES, the keyboard disables the return key when the text entry area contains no text. As soon as the user enters any text, the return key is automatically enabled.
- (UIKeyboardAppearance) keyboardAppearance
The appearance style of the keyboard that is associated with the text object (required) This property lets you distinguish between the default text entry inside your application and text entry inside an alert panel. The default value for this property is UIKeyboardAppearanceDefault.
- (UIKeyboardType) keyboardType
The keyboard style associated with the text object. (required) Text objects can be targeted for specific types of input, such as plain text, email, numeric entry, and so on. The keyboard style identifies what keys are available on the keyboard and which ones appear by default. The default value for this property is UIKeyboardTypeDefault.
- (UIReturnKeyType) returnKeyType
The contents of the “return” key. (required) Setting this property to a different key type changes the title of the key and typically results in the keyboard being dismissed when it is pressed. The default value for this property is UIReturnKeyDefault.
- (Boolean) secureTextEntry
Identifies whether the text object should hide the text being entered. (required) This property is set to NO by default. Setting this property to YES creates a password-style text object, which hides the text being entered.
- (UITextSpellCheckingType) spellCheckingType
The spell-checking style for the text object. (required) This property determines whether spell-checking is enabled or disabled during typing. With spell-checking enabled, the text object generates red underlines for all misspelled words. If the user taps on a misspelled word, the text object presents the user with a list of possible corrections. The default value for this property is UITextSpellCheckingTypeDefault, which enables spell-checking when auto-correction is also enabled. The value in this property supersedes the spell-checking setting set by the user in Settings > General > Keyboard.