无法在xCode 4.4上的新项目上的UIWebView上显示键盘 [英] Can't show a keyboard on UIWebView on new project on xCode 4.4
问题描述
我刚刚在xCode 4.4上创建了一个新的Single View Application.它是使用.storyboards文件(而不是xib)创建的.然后,我添加了一个UIWebView.现在,我无法通过代码行显示键盘:
I have just created a new Single View Application on xCode 4.4. And it was created with .storyboards files (instead xib). Then I have added a UIWebView. And now I can't show a keyboard by the code line:
[self.window MakeKeyAndVisible];
因为ViewController.m上没有任何 window
.如何在这个新的xCode项目模板上强制在UIWebView上显示键盘?
Because there is no any window
on ViewController.m. How to force showing a keyboard on UIWebView on this new xCode project template?
非常感谢您的帮助!
推荐答案
您始终可以从UIApplicationDelegate对象获取window属性.由于这是一个单例对象,因此可以使用:
You can always get the window property from the UIApplicationDelegate object. Since this is a singleton object, you can use:
[[UIApplication sharedApplication] delegate];
您可以在其中到达window属性.
There you can reach the window property.
这篇关于无法在xCode 4.4上的新项目上的UIWebView上显示键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!