简体   繁体   English

在数字键盘上显示丢弃和完成按钮

[英]Showing discard & done buttons on number keypad

I want to add a "Discard" and a done button in my number keypad. 我想在数字键盘上添加“放弃”和“完成”按钮。 Please see the image below. 请参见下图。

Do IOS provide these buttons by-default or do I need to add images for them. IOS默认提供这些按钮还是我需要为其添加图像。

iPhone数字键盘

There are some unofficial techniques you can use to hack the keyboard view and add your own button(s) to cover the keyboard keyboard (google for it if you want), but these are unreliable (likely to stop working in a future release) and could get your app banned from the app store (you are not supposed to customise things like that). 您可以使用一些非官方的技术来破解键盘视图并添加自己的按钮来覆盖键盘键盘(如果需要,可以使用Google的键盘),但是这些技术不可靠(有可能在以后的版本中停止工作)并且可能会使您的应用被应用商店禁止(您不应自定义类似的内容)。

The recommended technique is to place your own done button above the keyboard view, as Safari does it (see this screenshot for <input type="tell"> in mobile safari: http://www.456bereastreet.com/archive/201004/html5_input_types/ ). 推荐的技术是像Safari一样在键盘视图上方放置您自己的完成按钮(有关移动浏览器中的<input type="tell"> ,请参见以下屏幕快照: http : //www.456bereastreet.com/archive/201004/ html5_input_types / )。

These buttons are created with an "accessory view" on your text field. 这些按钮是在您的文本字段上使用“附件视图”创建的。 Apple has sample code how to do so here: http://developer.apple.com/library/ios/#samplecode/KeyboardAccessory/Introduction/Intro.html Apple在此处提供了示例代码,该方法如下: http : //developer.apple.com/library/ios/#samplecode/KeyboardAccessory/Introduction/Intro.html

Sorry, but you need to roll your own. 抱歉,但您需要自己动手。

You can follow this method more or less. 您可以或多或少地遵循方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM