iOS

Using the Keyboard 使用键盘

GUI Elements (GUI元素)

The keyboard will appear automatically when a user taps on editable GUI elements. Currently, GUI.TextField, GUI.TextArea andGUI.PasswordField will display the keyboard; see the GUI class documentation for further details.

当用户点击可编辑的GUI元素时键盘将自动出现。当前,GUI.TextField、GUI.TextArea和GUI.PasswordField会显示键盘;更多的细节请查看GUI类。

Manual Keyboard Handling 手动键盘操作

Use the iPhoneKeyboard.Open function to open the keyboard. Please see the iPhoneKeyboard scripting reference for the parameters that this function takes.

使用iPhoneKeyboard.Open方法来打开键盘。关于iPhoneKeyboard的详细参数请查看iPhoneKeyboard脚本参考。

Keyboard Type Summary 键盘类型总结

The Keyboard supports the following types:

键盘支持以下几种类型:

  • iPhoneKeyboardType.Default
    Letters. Can be switched to keyboard with numbers and punctuation.
    字母键盘。可以切换到数字和标点键盘。
  • iPhoneKeyboardType.ASCIICapable
    Letters. Can be switched to keyboard with numbers and punctuation.
    字母键盘。可以切换到数字和标点键盘。
  • iPhoneKeyboardType.NumbersAndPunctuation
    Numbers and punctuation. Can be switched to keyboard with letters.
    数字和标点键盘。可以切换到字符键盘。
  • iPhoneKeyboardType.URL
    Letters with slash and .com buttons. Can be switched to keyboard with numbers and punctuation.
    包含斜线以及.com按钮的字母键盘。可以切换到数字和标点键盘。
  • iPhoneKeyboardType.NumberPad
    Only numbers from 0 to 9. 仅0-9九个数字按键。
  • iPhoneKeyboardType.PhonePad
    Keyboard used to enter phone numbers. 拨号键盘。
  • iPhoneKeyboardType.NamePhonePad
    Letters. Can be switched to phone keyboard. 
    字母键盘。能够切换到拨号键盘。
  • iPhoneKeyboardType.EmailAddress
    Letters with @ sign. Can be switched to keyboard with numbers and punctuation.
    包含@键的字母键盘。能够切换到数字和标点键盘。

Text Preview 文本预览

By default, an edit box will be created and placed on top of the keyboard after it appears. This works as preview of the text that user is typing, so the text is always visible for the user. However, you can disable text preview by setting iPhoneKeyboard.hideInput to true. Note that this works only for certain keyboard types and input modes. For example, it will not work for phone keypads and multi-line text input. In such cases, the edit box will always appear. iPhoneKeyboard.hideInput is a global variable and will affect all keyboards.

默认情况下,编辑框将被创建并置于键盘的上方。这是作为用户输入的文本预览,因此对用户文本总是可见的。当然,你可以通过设置iPhoneKeyboard.hideInput=true来禁用文本预览。请注意,这仅适用于某些键盘类型和输入模式。例如:不能工作于拨号键盘以及多行文本输入。在这种情况下,编辑框将始终出现。iPhoneKeyboard.hideInput是一个全局变量,会影响所有的键盘。

Keyboard Orientation 键盘方向

By default, the keyboard automatically follows the device orientation. To disable or enable rotation to a certain orientation, use the following properties available in iPhoneKeyboard:

默认情况下,键盘将自动跟踪设备方向。要禁用或启用某个方向的旋转,可以设置iPhoneKeyboard一下属性。

  • autorotateToPortrait
    Enable or disable autorotation to portrait orientation (button at the bottom).
    启用或禁用自动旋转到纵向(按钮在底部)。
  • autorotateToPortraitUpsideDown
    Enable or disable autorotation to portrait orientation (button at top).
    启用或禁用自动旋转到纵向(按钮在顶部)。
  • autorotateToLandscapeLeft
    Enable or disable autorotation to landscape left orientation (button on the right).
    启用或禁用自动旋转到左横向(键盘在右侧) 。
  • autorotateToLandscapeRight
    Enable or disable autorotation to landscape right orientation (button on the left).
    启用或禁用自动旋转到右横向(键盘在左侧)。

Visibility and Keyboard Size 键盘可见性和尺寸

There are three keyboard properties in iPhoneKeyboard that determine keyboard visibility status and size on the screen.

iPhoneKeyboard有三个参数设置键盘的在屏幕上的可见性以及大小属性。

  • visible 可见性
    Returns true if the keyboard is fully visible on the screen and can be used to enter characters.
    如果键盘在屏幕上完全可见并且可以输入字符,返回true。
  • area 区域
    Returns the position and dimensions of the keyboard.
    返回键盘的位置及尺寸。
  • active 激活
    Returns true if the keyboard is activated. This property is not static property. You must have a keyboard instance to use this property.
    如果键盘被激活,返回true。这是一个非静态属性,使用这个属性你必须有一个键盘实例。

Note that iPhoneKeyboard.area will return a rect with position and size set to 0 until the keyboard is fully visible on the screen. You should not query this value immediately after iPhoneKeyboard.Open. The sequence of keyboard events is as follows:

请注意:直到键盘完全显示在屏幕上之前,iPhoneKeyboard.area返回的位置和大小都将为0。你不能在设置iPhoneKeyboard.Open之后立即查询此值。键盘事件的顺序如下:

  • iPhoneKeyboard.Open is called. iPhoneKeyboard.active returns true. iPhoneKeyboard.visible returns false. iPhoneKeyboard.area returns (0, 0, 0, 0). 
    当iPhoneKeyboard.Open被调用,iPhoneKeyboard.active返回true,iPhoneKeyboard.visible返回false,iPhoneKeyboard.area返回(0,0,0,0);
  • Keyboard slides out into the screen. All properties remain the same. 
    当键盘滑进屏幕。所有属性保持不变。
  • Keyboard stops sliding. iPhoneKeyboard.active returns true. iPhoneKeyboard.visible returns true. iPhoneKeyboard.area returns real position and size of the keyboard. 
    当键盘停止滑动,完全在屏幕上显示。iPhoneKeyboard.active返回true,iPhoneKeyboard.visible返回true,iPhoneKeyboard.area返回键盘的真实位置和大小。

Secure Text Input 安全的文本输入

It is possible to configure the keyboard to hide symbols when typing. This is useful when users are required to enter sensitive information (such as passwords). To manually open keyboard with secure text input enabled, use the following code:

能够设置在键盘输入时隐藏字符。当用户输入敏感信息时这是非常有用的(如输入密码)。要手动打开文本输入的安全性设置,请使用下面的代码:

iPhoneKeyboard.Open("", iPhoneKeyboardType.Default, false, false, true);

Hiding text while typing 输入时隐藏文本

Alert keyboard 警醒键盘

To display the keyboard with a black semi-transparent background instead of the classic opaque, call iPhoneKeyboard.Open as follows:

要显示一个黑色半透明的背景键盘而非经典的不透明键盘,调用iPhoneKeyboard.Open如下:

iPhoneKeyboard.Open("", iPhoneKeyboardType.Default, false, false, true, true);

Classic keyboard 经典键盘

Alert keyboard 警醒键盘

Android

Unity Android reuses the iOS API to display system keyboard. Even though Unity Android supports most of the functionality of its iPhone counterpart, there are two aspects which are not supported:

Unity Android 在显示系统键盘方面重用了IOS的API,虽然Unity Android支持大部分的与IPhone对应的功能,但是有以下两点功能不支持:

  • iPhoneKeyboard.hideInput
  • iPhoneKeyboard.area

Please also note that the layout of a iPhoneKeyboardType can differ somewhat between devices.

请注意:iPhoneKeyboardType 的样式在不同的设备上有所不同。

Unity 手机键盘相关推荐

  1. Unity之手机键盘自定义输入栏位置适配不同手机分辨率适配

    Unity之手机键盘自定义输入栏位置适配&不同手机分辨率适配 效果图 PC端展示 手机端展示(手机是顶部带摄像头的IQOO Neo 5 ) 设计思路 也没啥思路不思路的,就是获取键盘高度,在安 ...

  2. Unity手机输入法弹出键盘挡住游戏UI的问题

    文章目录 问题 解决办法 Android iOS 调用 问题 在手机上,点击输入框,会弹出输入法的键盘,这个时候如果UI没有做自适应处理,则会被输入法键盘窗口挡住,如下图微信是做了自适应的,在Unit ...

  3. 隐藏与显现_手机键盘摇一摇,隐藏功能立马显现,太棒了

    手机是我们每天都要用的,但如果我们把手机键盘给它摇一摇,它会有什么什么的作用呢?一起来看看吧! 第一个就是我们平时打字的时候,我们会打很多的字发给对方,如果突然间后悔了那么多的字,如果我们按删除键的话 ...

  4. 牛客网 -- 计算机历年考研复试上机题 -- 手机键盘

    题目描述 按照手机键盘输入字母的方式,计算所花费的时间 如:a,b,c都在"1"键上,输入a只需要按一次,输入c需要连续按三次. 如果连续两个字符不在同一个按键上,则可直接按,如: ...

  5. android+tv+无线键盘,手机键盘有那些 5款适合手机使用的无线键盘推荐

    现在我们热几乎人手拥有一台智能手机,我们可以用手机里面的输入法来进行打字或者聊天,平时使用起来还是比较方便了,但是需要用你的手机发一封电子邮件或者要写很多字的话,那么手机的输入法就不是那么合适呢,这是 ...

  6. onenetsim定位功能吗_经常玩手机的抓紧看看,原来手机键盘还隐藏4个实用功能,真实用...

    可爱的人都关注我了,就差你了 1 在日常生活中,大家对手机的依赖性越来越大,不管走到哪,时时刻刻都拿着手机发信息.可是,用了这么久的手机,你真的会用手机键盘吗?你知道手机键盘上隐藏的小功能吗?手机键盘 ...

  7. ionic4的input调用手机键盘将换行改成搜索

    ionic4的input调用手机键盘将换行改成搜索 我们在写输入框的时候通常会这样写,如下: <ion-input type="search" value="&qu ...

  8. 手机键盘(简单模拟)

    #题目描述 清华大学研究生复试机试真题 按照手机键盘输入字母的方式,计算所花费的时间 如:a,b,c都在"1"键上,输入a只需要按一次,输入c需要连续按三次. 如果连续两个字符不在 ...

  9. 【web前端特效源码】使用HTML5+CSS3+JavaScript制作一个复古手机键盘(带声音)的动画效果~~适合初学者~超简单~

    b站视频演示效果: [web前端特效源码]使用HTML5+CSS3制作一个复古手机键盘(带声音)的动画效果~~适合初学者~超简单~ |前端开发|IT软件 效果图: 完整代码: <!DOCTYPE ...

最新文章

  1. 机器学习如何彻底改变游戏中的物理模拟
  2. 11gR2 RAC启用iptables导致节点宕机问题处理
  3. javascript 自定义类型
  4. 70条程序员编程的专业名言,你认可几条?
  5. 线上python课程一般多少钱-专业Python实战课程|学习Python需要多少钱?
  6. [转载] python存数据库、c++读数据库_如何从C中读取python pickle数据库/文件?
  7. linux两个树莓派通信,Arduino与树莓派间的通信实践
  8. matlab的默认字体_为MATLAB更换支持中文的等宽字体
  9. 再爆hzhost6.5虚拟主机管理系统的SQL注入漏洞3
  10. PHP7.1 mcrypt_module_open() is deprecated
  11. 3D打印开源软件Cura分析(1) 【转】
  12. STM32测量PWM波频率及占空比
  13. 马晓:Serverless SSR 在人人视频的落地探索
  14. 【莹伙丛】Dependencies should no longer be declared using the compile and runtime configurations
  15. winform显示中国农历
  16. attempt to configure ONS in FanManager failed with oracle.ons.NoServersAvailable: Subscription time
  17. Laravel学习记录--LaravelDebugbar
  18. 简单的用户登陆界面c程序
  19. linux下的zz命令,[zz]Linux下压缩命令
  20. android 免root调用系统工具,免root自动化助手

热门文章

  1. NXP JN5169使用代码模板新建外设工程
  2. lorawan在嵌入式系统中的实现--节点端(一)--SX1278介绍
  3. 打造自己的LoRaWAN网关,进阶2:处理异常
  4. 10t桥式起重机总体设计(有cad图+开题、中期报告+文献翻译)
  5. 人工智能行业市场分析
  6. 如何确定当前的S7-1200PLC使用的具体的博途软件
  7. 激动人心!昨晚,这场盛会在青岛开幕!
  8. Pervasive Java
  9. Fitnesse启动参数与配置
  10. jsp登录界面(一)