如何在没有 UITextField 或 UITextView 的情况下调出 UIKeyboard? [英] How to pull up a UIKeyboard without a UITextField or UITextView?

查看:12
本文介绍了如何在没有 UITextField 或 UITextView 的情况下调出 UIKeyboard?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为 iPhone 和 iPod touch 开发 OpenGL ES 游戏.

I'm currently developing an OpenGL ES game for the iPhone and iPod touch.

我想知道如何轻松调出 UIKeyboard?是否有官方文档可以在不使用 UITextView 的 UITextField 的情况下调出 UIKeyboard?

I was wondering how I can easily pull up the UIKeyboard? Is there an official, documented possibility to pull up a UIKeyboard without using a UITextField of UITextView?

推荐答案

这不是官方"可能的 - 在 Apple 的指导下,您根本无法访问 UIKeyboard 对象.

It's not "officially" possible - you can't access the UIKeyboard object at all while staying within Apple's guidelines.

创建一个不可见的 UITextField,然后调用 [textField becomeFirstResponder] 即可完成这项工作 - 您甚至可以先将 UITextField 子类化,然后覆盖委托方法 textField:shouldChangeCharactersInRange: 以将文本输入重定向到您想要的位置.

Creating an invisible UITextField, then calling [textField becomeFirstResponder] would do the job - you could even subclass UITextField first, then override the delegate method textField:shouldChangeCharactersInRange: to redirect the text input to where you want it to go.

这篇关于如何在没有 UITextField 或 UITextView 的情况下调出 UIKeyboard?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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