如何在iPhone OS 4上的数字键盘上显示“完成”按钮? [英] How to show button ‘Done’ on number pad on iPhone OS 4?

查看:110
本文介绍了如何在iPhone OS 4上的数字键盘上显示“完成”按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iPhone数字键盘键盘上添加一个完成按钮。左下方甚至还有一个方便的空间用于这样一个按钮。

I'd like to add a Done button to the iPhone number pad keyboard. There's even a handy space at the bottom left for just such a button.

以前,我使用的方法类似于问题584538 Luzian Scherrer的优秀博客文章,但在iOS 4中停止工作。我可以做它通过创建自定义inputView,但我更喜欢扩展Apple的键盘,而不是自己编写。

Previously, I was using a similar trick to those described in Question 584538 and Luzian Scherrer's excellent blog post, but that stopped working in iOS 4. I can do it by creating a custom inputView, but I'd prefer to extend Apple's keyboard instead of writing my own.

是否有一种新方法可以将标准键盘添加到标准键盘?有人为此发布了OSS inputView吗?还有另外一种方法吗?

Is there a new way to add a view to the standard keyboard? Has someone published an OSS inputView for this? Is there another way?

推荐答案

Luzian Scherrer的博客文章 在iOS 4.0中工作。

The technique described in Luzian Scherrer's blog post does work in iOS 4.0.

我将键盘添加到键盘的代码失败了,因为它是从 textFieldDidBeginEditing:委托方法调用的,在创建键盘窗口的子视图之前调用4.0)。我在观察到 UIKeyboardWillShowNotification 时调用了我的代码来解决这个问题,这种情况发生得太晚了。

My code to add the button to the keyboard was failing because it was being called from the textFieldDidBeginEditing: delegate method, which (in 4.0) is called before the keyboard window's subviews are created. I fixed the problem by calling my code when UIKeyboardWillShowNotification is observed, which happens late enough.

这篇关于如何在iPhone OS 4上的数字键盘上显示“完成”按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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