UITextField键盘不会出现 [英] UITextField keyboard doesn't appear
问题描述
我有一个非常简单的屏幕,带有默认配置的UITextField,没什么特别的。
当我触摸UITextField时,键盘不会弹出。
我没有任何自定义控件,行为或其他任何东西,只是这样,但它没有工作。
我已经在以前的应用程序中完成了这个iPhone / iPad应用程序已经在AppStore,但我无法弄清楚这里出了什么问题。
I have a very simple screen with an UITextField with the default configuration, nothing special.
When I touch the UITextField, the keyboard doesn't pops up.
I haven't any custom control, behavior or anything else, just that, but it doesnt'work.
I've done this in previous apps iPhone/iPad apps already on the AppStore but i can't figure out what's going wrong here.
UITextField是在Interface Builder中的nib文件中创建的。
I我一直在做一些研究,我在UIViewController中添加了一个用于UItextField TouchDown事件的IBAction和用于UITexField的IBOutlet。
在我添加的代码的第一行:
The UITextField is created in Interface Builder, in the nib file.
I've been doing some research and i added an IBAction in the UIViewController for UItextField TouchDown event and the IBOutlet for the UITexField.
In the first line of the code i added:
[textFild becomeFirstResponder];
这是UITextField的默认行为,当你触摸它时,它成为第一个询问系统的响应者显示键盘。
我调试它并运行该行,但键盘仍未显示。
提前致谢。
That's the default behavior of the UITextField, when you touch it, it becomes the first responder asking the system to show the keyboard.
I debugged it and it runs that line, but the keyboard still doesn't shows up.
Thanks in advance.
推荐答案
我自己已经想通了!
我在UIViewController中有UITextField,它来自另一个视图控制器
,它响应运动事件,而之前的View Controller总是第一响应者。
所有我必须做的就是每次我在viewWillDisappear中留下控制器的视图:( BOOL)动画,我叫[self resignFirstResponder];这就是全部。
I already figured out by myself! I had tha UITextField in a UIViewController that gets presented from another view controller who responds to motion events, and that previous View Controller was allways the First Responder. All I had to do was everytime i leave the controller's view in viewWillDisappear:(BOOL)animated, i called [self resignFirstResponder]; and that was all.
这篇关于UITextField键盘不会出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!