我可以在iPad上使用哪种UIKeyboardType [英] Which UIKeyboardType can I use on the iPad

查看:710
本文介绍了我可以在iPad上使用哪种UIKeyboardType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iPad应用中有一个textField对象。我想给用户一个方便的键盘来输入数字。在我的代码中,我添加了:

I have a a textField object in my iPad app. I would like to give the user a convenient keyboard for entering numbers. In my code I added:

UITextField *textField = [[UITextField alloc] initWithFrame:frame];
textField.keyboardType = UIKeyboardTypeDecimalPad;

根据文档,这是一种有效的键盘类型,但是当我编辑文本字段时,正常的ASCII键盘过来。但是,当我将其更改为:

According to the docs this is a valid keyboard type but when I edit the text field the normal ASCII keyboard comes up. However, when I change it to:

textField.keyboardType = UIKeyboardTypePhonePad;

键盘如下所示:

The keyboard looks like this:

理想情况下,我想要一个只有数字和小数点的键盘但这在iPad上是不可能的?有没有人有一个明确的列表,其中哪些键盘适用于iPhone和iPad?苹果目前还不清楚这一点。我也看到了这个问题,但这些答案都没有真正解决我的观点。

Ideally I would like a keyboard that only has the numbers and decimal point but is this not possible on the iPad? Does anyone have a definitive list of which keyboards work on the iPhone vs. iPad? Apple is unclear on this point. I also saw this question which is similar but none of the answers really address my point.

推荐答案

这些是可以在两个iOS设备上使用的UIKeyboardTypes。从的文档

These are the UIKeyboardTypes that can be used on both iOS devices. From the docs:



  • UIKeyboardTypeDefault


  • 使用默认键盘作为当前输入法。

  • 适用于iOS 2.0及更高版本。

  • 声明在 UITextInputTraits.h


  • Use the default keyboard for the current input method.
  • Available in iOS 2.0 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypeASCIICapable


  • 使用显示标准ASCII字符的键盘。

  • 适用于iOS 2.0及更高版本。

  • UITextInputTraits.h 中声明。



  • Use a keyboard that displays standard ASCII characters.
  • Available in iOS 2.0 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypeNumbersAndPunctuation


  • 使用数字和标点符号键盘。

  • 适用于iOS 2.0及更高版本。

  • 声明为 UITextInputTr aits.h


  • Use the numbers and punctuation keyboard.
  • Available in iOS 2.0 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypeURL


  • 使用针对URL条目优化的键盘。此类型突出显示。,/和.com。

  • 适用于iOS 2.0及更高版本。

  • 声明在 UITextInputTraits.h


  • Use a keyboard optimized for URL entry. This type features ".", "/", and ".com" prominently.
  • Available in iOS 2.0 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypeNumberPad


  • 使用专为PIN输入设计的数字小键盘。此类型突出显示数字0到9。此键盘类型不支持
    支持自动大写。

  • 适用于iOS 2.0及更高版本。

  • UITextInputTraits.h 。


  • Use a numeric keypad designed for PIN entry. This type features the numbers 0 through 9 prominently. This keyboard type does not support auto-capitalization.
  • Available in iOS 2.0 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypePhonePad


  • 使用专为输入电话号码而设计的键盘。此类型的数字为0到9,*和#字符为
    。此键盘类型不支持自动大写。

  • 适用于iOS 2.0及更高版本。

  • UITextInputTraits.h中声明


  • Use a keypad designed for entering telephone numbers. This type features the numbers 0 through 9 and the "*" and "#" characters prominently. This keyboard type does not support auto-capitalization.
  • Available in iOS 2.0 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypeNamePhonePad


  • 使用专为输入人名或电话号码而设计的键盘。此键盘类型不支持自动大写。

  • 适用于iOS 2.0及更高版本。

  • UITextInputTraits.h中声明


  • Use a keypad designed for entering a person’s name or phone number. This keyboard type does not support auto-capitalization.
  • Available in iOS 2.0 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypeEmailAddress


  • 使用优化的键盘来指定电子邮件地址。此类型突出显示@,。和空格字符。

  • 适用于iOS 2.0及更高版本。

  • 在<$ c中声明$ c> UITextInputTraits.h 。


  • Use a keyboard optimized for specifying email addresses. This type features the "@", "." and space characters prominently.
  • Available in iOS 2.0 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypeDecimalPad


  • 使用带数字和小数点的键盘。

  • 适用于iOS 4.1及更高版本。

  • UITextInputTraits.h 中声明。


  • Use a keyboard with numbers and a decimal point.
  • Available in iOS 4.1 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypeTwitter


  • 使用针对Twitter文本条目优化的键盘,可以轻松访问@和#字符。

  • 适用于iOS 5.0及更高版本。

  • UITextInputTraits.h 中声明。


  • Use a keyboard optimized for twitter text entry, with easy access to the @ and # characters.
  • Available in iOS 5.0 and later.
  • Declared in UITextInputTraits.h.

UIKeyboardTypeAlphabet


  • 已弃用。

  • 使用UIKeyboardTypeASCIICapable代替。

  • 在iOS 2.0中可用

  • UITextInputTraits.h 中声明。


  • Deprecated.
  • Use UIKeyboardTypeASCIICapable instead.
  • Available in iOS 2.0 and later.
  • Declared in UITextInputTraits.h.

以下是不同类型键盘的截图

这篇关于我可以在iPad上使用哪种UIKeyboardType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆