码迷,mamicode.com
首页 > 移动开发 > 详细

iOS-键盘弹出的类型

时间:2016-05-07 07:54:32      阅读:648      评论:0      收藏:0      [点我收藏+]

标签:

iOS 提供了10种键盘类型,在开发中,我们可以根据不同的需求,选择不同的键盘样式,例如,当我们只需要输入手机号码时,可以选择纯数字类型的键盘(NumbersAndPunctuation),当我们需要输入网址时,可以选择URL样式的键盘(UIKeyboardTypeURL),其中,默认的键盘样式(UIKeyboardTypeDefault)就是(UIKeyboardTypeNamePhonePad)样式。

我们可以通过输入框的 keyboardType 来设置键盘样式

UITextField.keyboardType = UIKeyboardTypeNamePhonePad;
 1、  UIKeyboardTypeDefault,
        // Default type for the current input method.
 2、  UIKeyboardTypeASCIICapable,           
        // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active
 3、  UIKeyboardTypeNumbersAndPunctuation,  
        // Numbers and assorted punctuation.
 4、  UIKeyboardTypeURL,                    
        // A type optimized for URL entry (shows . / .com prominently).
 5、  UIKeyboardTypeNumberPad,              
        // A number pad (0-9). Suitable for PIN entry.
 6、  UIKeyboardTypePhonePad,               
        // A phone pad (1-9, *, 0, #, with letters under the numbers).
 7、  UIKeyboardTypeNamePhonePad,           
        // A type optimized for entering a person‘s name or phone number.
 8、  UIKeyboardTypeEmailAddress,           
        // A type optimized for multiple email address entry (shows space @ . prominently).
 9、  UIKeyboardTypeDecimalPad NS_ENUM_AVAILABLE_IOS(4_1),   
        // A number pad with a decimal point.
 10、 UIKeyboardTypeTwitter    NS_ENUM_AVAILABLE_IOS(5_0),   
        // A type optimized for twitter text entry (easy access to @ #)
 11、 UIKeyboardTypeWebSearch NS_ENUM_AVAILABLE_IOS(7_0),    
        // A default keyboard type with URL-oriented addition (shows space . prominently).

下面一图像展示区别
UIKeyboardTypeDefault
技术分享

UIKeyboardTypeNumbersAndPunctuation
技术分享

UIKeyboardTypeURL
技术分享

UIKeyboardTypeNumberPad
技术分享

UIKeyboardTypePhonePad
技术分享

UIKeyboardTypeEmailAddress
技术分享

UIKeyboardTypeDecimalPad
技术分享

UIKeyboardTypeTwitter
技术分享

UIKeyboardTypeWebSearch
技术分享

iOS-键盘弹出的类型

标签:

原文地址:http://blog.csdn.net/mazy_ma/article/details/51333303

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!