Keyboard style settings-iOS development, keyboard style-ios
I. keyboard Style
The UIKit framework supports 8 types of keyboards.
- TypedefEnum{
- UIKeyboardTypeDefault, // default keyboard: All characters are supported
- UIKeyboardTypeASCIICapable, // supports the default ASCII keyboard
- UIKeyboardTypeNumbersAndPunctuation, // standard phone keyboard, supporting + * # and other symbols
- UIKeyboardTypeURL, // URL keyboard, with. com buttons; only URL characters are supported
- UIKeyboardTypeNumberPad, // numeric keypad
- UIKeyboardTypePhonePad, // telephone keyboard
- UIKeyboardTypeNamePhonePad, // telephone keyboard, also supports the user name
- UIKeyboardTypeEmailAddress, // Keyboard used to enter the email address
- } UIKeyboardType;
Usage example:
TextView. keyboardtype = UIKeyboardTypeNumberPad;
Ii. keyboard appearance
- TypedefEnum{
- UIKeyboardAppearanceDefault, // default appearance: light gray
- UIKeyboardAppearanceAlert, // dark gray/Graphite
- } UIKeyboardAppearance;
Usage example:
TextView. keyboardAppearance = UIKeyboardAppearanceDefault;
Iii. Enter key
- Typedef enum {
- UIReturnKeyDefault, // default: gray button, marked with Return
- UIReturnKeyGo, // the blue button marked with Go
- UIReturnKeyGoogle, // the blue button marked with Google for search
- UIReturnKeyJoin, // the blue button marked with Join
- UIReturnKeyNext, // the blue button marked with Next
- UIReturnKeyRoute, // the blue button marked with Route
- UIReturnKeySearch, // the blue button marked with Search
- UIReturnKeySend, // the blue button marked with Send
- UIReturnKeyYahoo, // marked with Yahoo! To search
- UIReturnKeyDone, // the blue button marked with Done
- UIReturnKeyEmergencyCall, // emergency call button
- } UIReturnKeyType;
Usage example:
TextView. returnKeyType = UIReturnKeyGo;
4. Automatic capital
- TypedefEnum{
- UITextAutocapitalizationTypeNone, // It is not automatically capitalized
- UITextAutocapitalizationTypeWords, // uppercase of the first letter of the word
- UITextAutocapitalizationTypeSentences, // The first letter of the sentence is capitalized
- UITextAutocapitalizationTypeAllCharacters, // all uppercase letters
- } UITextAutocapitalizationType;
Usage example:
TextField. autocapitalizationType = UITextAutocapitalizationTypeWords;
5. Automatic Correction
- TypedefEnum{
- UITextAutocorrectionTypeDefault, // default
- UITextAutocorrectionTypeNo, // not automatically corrected
- UITextAutocorrectionTypeYes, // automatically corrected
- } UITextAutocorrectionType;
Usage example:
TextField. autocorrectionType = UITextAutocorrectionTypeYes;
Vi. Security text input
TextView. secureTextEntry = YES;
Enabling secure input is mainly used for password or private data input. Automatic correction and the cache are disabled.
How can I set the keyboard type?
Next, see:
Set this method in TextviewDelegate:
// Return NO to disallow editing.-(BOOL) textFieldShouldBeginEditing :( UITextField *) textField {
TextView. keyboardtype = UIKeyboardTypeNumberPad;
// TextField. returnKeyType = UIReturnKeyYahoo; // the same as search // textField. returnKeyType = UIReturnKeyEmergencyCall; // EmergencyCall // textField. returnKeyType = UIReturnKeyGoogle; // the same as search textField. returnKeyType = UIReturnKeyDefault;
}
So how can we control the display or hiding of a specific type of button?
Waiting .......
After IOS7 is upgraded, the keyboard is still iOS 6. How can I set the keyboard to iOS 7 in the application?
After iOS7 is upgraded, only those applications provided by Apple, such as memos and information, are iOS 7. For third-party applications that you download and install, if the iOS7-compatible version is not released, the keyboard style should be the same as before. After a while, many applications should be updated to be compatible with iOS7. The keyboard of the latest 5.0.3 version is iOS 7.
I am a beginner in ios development and asked how ios can automatically switch the keyboard.
Ios keyboard settings are generally bound to the properties of the input control. Such as UITextField, UITextView, and UISearchBar.
TextField. keyboardType = UIKeyboardTypeAlphabet;
UIKeyboardType has the following types. The displayed keyboard varies depending on the type you set.
UIKeyboardTypeAlphabet
UIKeyboardTypeASCIICapable
UIKeyboardTypeDecimalPad
UIKeyboardTypeDefault
UIKeyboardTypeEmailAddress
UIKeyboardTypeNamePhonePad
UIKeyboardTypeNumberPad
......