First, the keyboard style
The Uikit Framework supports 8 styles of keyboards.
- typedef enum {
- Uikeyboardtypedefault, //default keyboard: All characters supported
- Uikeyboardtypeasciicapable, //ASCII-enabled default keyboard
- Uikeyboardtypenumbersandpunctuation, //Standard telephone keypad, supports +* #等符号
- Uikeyboardtypeurl, //URL keyboard with. com button; URL characters only
- Uikeyboardtypenumberpad, //numeric keypad
- Uikeyboardtypephonepad, //Telephone keypad
- Uikeyboardtypenamephonepad, //telephone keypad, also support input person name
- Uikeyboardtypeemailaddress, //keyboard for entering e-mail addresses
- } Uikeyboardtype;
Usage Use cases:
Textview.keyboardtype = Uikeyboardtypenumberpad;
Second, keyboard appearance
- typedef enum {
- Uikeyboardappearancedefault, //default appearance: Light grey
- Uikeyboardappearancealert, //dark grey/graphite
- } uikeyboardappearance;
Usage Use cases:
Textview.keyboardappearance=uikeyboardappearancedefault;
Third, enter
- typedef enum {
- Uireturnkeydefault,//default: Gray button, marked with return
- Uireturnkeygo,//blue button labeled Go
- Uireturnkeygoogle,//blue button labeled Google for search
- Uireturnkeyjoin,//blue button labeled Join
- Uireturnkeynext,//blue button labeled Next
- Uireturnkeyroute,//blue button labeled route
- Uireturnkeysearch,//blue button labeled Search
- Uireturnkeysend,//blue button labeled Send
- Uireturnkeyyahoo,//blue button labeled Yahoo! for searching
- Uireturnkeydone,//blue button labeled done
- Uireturnkeyemergencycall,//Emergency call button
- } Uireturnkeytype;
Usage Use cases:
Textview.returnkeytype=uireturnkeygo;
Four, automatic capitalization
- typedef enum {
- Uitextautocapitalizationtypenone, //not automatically capitalized
- Uitextautocapitalizationtypewords, //Capitalize The first letter of the word
- Uitextautocapitalizationtypesentences, //Capitalize The first letter of the sentence
- Uitextautocapitalizationtypeallcharacters, //All letters capitalized
- } Uitextautocapitalizationtype;
Usage Use cases:
Textfield.autocapitalizationtype = Uitextautocapitalizationtypewords ;
Five, automatic correction
- typedef enum {
- Uitextautocorrectiontypedefault, //default
- Uitextautocorrectiontypeno, //not automatically corrected
- Uitextautocorrectiontypeyes, // AutoCorrect
- } Uitextautocorrectiontype;
Usage Use cases:
TextField . Autocorrectiontype = Uitextautocorrectiontypeyes ;
Six, secure text input
Textview.securetextentry=yes;
Turning on secure input is primarily for passwords or some private data input, which disables AutoCorrect and self-caching.
So how do you set the keyboard type?
Next, take a look at:
In Textviewdelegate This method is set:
Return NO to disallow editing. -(BOOL) textfieldshouldbeginediting: (Uitextfield *) textfield{
Textview.keyboardtype = Uikeyboardtypenumberpad;
Textfield.returnkeytype = uireturnkeyyahoo;//the Same as search//textfield.returnkeytype = Uireturnkeyemergencyca ll Emergencycall//textfield.returnkeytype = uireturnkeygoogle;//the Same as search Textfield.returnkeytype = U Ireturnkeydefault;
}
IOS Keyboard has TextField automatic error correction, etc.