How to pull up a UIKeyboard without a UITextField or UITextView?(如何在没有 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在没有 UITextField 或 UITextView 的情况下调出 UIKeyboard?
基础教程推荐
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
