问题描述
我需要子类化UITextField或其他东西,并重新创建一个应用程序。 - 重新定义它是一个更抽象的文本输入小部件 - 真的我只需要一个UITextField生成的事件)或者我可以以某种方式显示键盘,接收它的事件,并自己解雇!
谢谢!
你可以使用一个框架来实例化一个UITextField,屏幕到左边或顶部,并确保父视图设置为剪辑子视图),然后调用 [myTextField becomeFirstResponder]
显示键盘。将您的视图控制器设置为UITextFieldDelegate,并按照这种方式跟随文本的所有更改,使用您的自定义绘图代码回显该字符串。
I am creating an app with core graphics that needs to take text input and place characters at specific pixel offsets.
Do I have to subclass UITextField or something and re-invent the wheel (redefine it to be a more abstract text entry widget - really I only need the events a UITextField generates) or can I somehow show the keyboard, receive it's events and dismiss it myself!
Thanks!
You could instantiate a UITextField with a frame that makes it invisible (off the "screen" to the left or the top for instance, and make sure the parent view is set to clip child views), and then call [myTextField becomeFirstResponder]
to show the keyboard. Make your view controller a UITextFieldDelegate and follow all changes to the text that way, echoing the string using your custom drawing code.
这篇关于使用没有UITextView或UITextField的系统键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!