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


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

UITextField.keyboardType = UIKeyboardTypeNamePhonePad;
  • 1
 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).
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

下面一图像展示区别

UIKeyboardTypeDefault


UIKeyboardTypeNumbersAndPunctuation


UIKeyboardTypeURL


UIKeyboardTypeNumberPad


UIKeyboardTypePhonePad


UIKeyboardTypeEmailAddress


UIKeyboardTypeDecimalPad


UIKeyboardTypeTwitter


UIKeyboardTypeWebSearch

ios 弹出不同的键盘的更多相关文章

  1. 点击底部input输入框,弹出的软键盘挡住input(苹果手机使用第三方输入法 )

    测试移动端页面的时候,偶然发现点击底部input输入框时,弹出的虚拟键盘偶尔会挡住input输入框. 输入框固定在页面底部,如图所示:   input固定底部设计图.png 点击底部input输入框唤 ...

  2. android 弹出的软键盘遮挡住EditText文本框的解决方案

    1.android 弹出的软键盘遮挡住EditText文本框的解决方案: 把Activit对应的布局文件filename.xml文件里的控件用比重设置布局.(例如:android:layout_wei ...

  3. IOS弹出视图 LewPopupViewController

    LewPopupViewController是一款IOS弹出视图软件.iOS 下的弹出视图.支持iPhone/iPad. 软件截图 使用方法 弹出视图 1 2 3 4 5 PopupView *vie ...

  4. input弹出的手机键盘搜索事件

    一.input的搜索框    在input标签里面把type设置为search就可以了.弹出的手机键盘回车键也会变成搜索或者是搜索的图标. <input id="search" ...

  5. Android - 隐藏EditText弹出的软键盘输入(SoftInput)

    隐藏EditText弹出的软键盘输入(SoftInput) 本文地址: http://blog.csdn.net/caroline_wendy 保持界面的整洁, 能够选择在进入界面时, 隐藏EditT ...

  6. 【小贴士】zepto find元素以及ios弹出键盘可能让你很头疼

    前言 在此,我不得不说移动端的兼容问题很多,并且很令人头疼,这不,这个星期又有两个让我逮着了,一个是使用zepto过程中出现的问题,一个是ios虚拟键盘的问题 我这里做一次记录,以免以后忘了,同时希望 ...

  7. iOS开发 编辑框被系统弹出的软键盘遮挡问题

    我们在开发注冊界面的时候,最后几个注冊条件经常easy被系统弹出的键盘遮挡,例如以下图: 能够看见,邮箱条件被遮挡掉了,怎么解决呢?我是通过UITextField的代理加计算偏移量: - (void) ...

  8. 关闭ios弹出框:“would like to use your current location”

    图一: 图二: 使用cordova生成ios项目,首次打开获取用户定位时会弹出两次对话框,关闭图二中对话框方法: document.addEventListener("deviceready ...

  9. android EditText设置弹出数字输入法键盘

    <EditText      android:id="@+id/edit_digit_input"      android:layout_width="wrap_ ...

随机推荐

  1. 解决Python中不能输入汉字的问题

    我们在python的IDE中有时候会输入中文,python对中文不是太友好.现在我们就解决这个问题.一般情况下在你的代码前面加入: # coding: utf-8 reload(sys)sys.set ...

  2. “(null)” is of a model that is not supported by this version of Xcode. Please use a different device.

    ios    真机运行程序就弹出这个"(null)" is of a model that is not supported by this version of Xcode. P ...

  3. 机器学习——支持向量机(SVM)之Platt SMO算法

    Platt SMO算法是通过一个外循环来选择第一个alpha值的,并且其选择过程会在两种方式之间进行交替: 一种方式是在所有数据集上进行单遍扫描,另一种方式则是在非边界alpha中实现单遍扫描. 所谓 ...

  4. React的井字过三关(1)

    React的井字过三关(1) 本文系React官方教程的Tutorial: Intro To React的笔记.由笔者用ES5语法改写. 在本篇笔记中,尝试用React构建一个可交互的井字棋游戏. 开 ...

  5. 记一次WinForm程序中主进程打开子进程并传递参数的操作过程(进程间传递参数)

    目标:想在WinForm程序之间传递参数.以便子进程作出相应的处理. 一种错误的方法 父进程的主程序: ProcessStartInfo psi = new ProcessStartInfo(); p ...

  6. webpack使用优化(基本篇)

    转自:https://github.com/lcxfs1991/blog/issues/2 前言 本文不是webpack入门文章,如果对webpack还不了解,请前往题叶的Webpack入门,或者阮老 ...

  7. javascript 日期操作

    1.获取指定年月有多少周 /** * 获得一个月的周数 * @param {} y {xxxx}4位数 * @param {} m {0-11} * @return {} */ function ge ...

  8. git pull和git fetch的区别

    Git中从远程的分支获取最新的版本到本地有这样2个命令:1. git fetch:相当于是从远程获取最新版本到本地,不会自动merge Git fetch origin master git log ...

  9. python 类定义 继承

    0 前言 系统:win7 64bit IDE : python(x,y) 2.7.6.1 IDE集成的解释器:Python 2.7.6 (default, Nov 10 2013, 19:24:18) ...

  10. Why did I have a recovery trip

    For more than a decade, I felt most at ease living out of a suitcase, never quite sure where I might ...