本文介绍了如何在没有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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 12:07