问题描述
这一定是某种我看不见的新手错误,对于要检查什么或在哪里看的提示,我深表感谢.
This has to be some kind of newbie blunder that I just can’t see, and I’d be grateful for hints as to what to check or where to look.
我遵循了具有UITextField的iPhone教程,请确保我已为文本字段连接了IBOutlet,并且它似乎可以正确编译(没有错误或警告).但是,当我在模拟器下运行它并单击该字段时,我没有键盘,因此我无法在该字段中输入任何内容.
I've followed an iPhone tutorial that has a UITextField, making sure I connected the IBOutlet for the text field, and it seems to compile properly (no errors or warnings). But when I run it under the simulator, and click in the field, I don’t get the keyboard, so I can’t enter anything into the field.
我曾尝试在网站上搜索类似的问题,而我发现的只是几个问题,其中开发人员正试图通过多个控制器来设置一些复杂的UI,而这似乎是一个相同的问题,但是最初的发布者只是说他通过启动一个新项目并移植代码解决了该问题.我想找到一个实际的解决方案,所以当这个问题再次出现时,我不必尝试随机重建项目.
I’ve tried searching the site for similar questions, and all I’ve found is a few questions where the developer is trying to set up some complex UI with multiple controllers, and one that seemed to be the same issue, but the original poster simply said that he solved it by starting a new project and porting the code over. I’d like to find an actual solution, so I don’t have to try randomly rebuilding projects when this issue comes up again.
谢谢!
推荐答案
在进行故障排除时,只要涵盖所有基础,请确保不是iOS模拟器引起的.我也没有在输入UITextView时看到键盘出现,事实证明模拟器允许您在显示虚拟键盘和只使用笔记本电脑的键盘之间进行切换.
Just to cover all your bases when troubleshooting this, make sure it's not the iOS Simulator that's causing this. I wasn't seeing the keyboard appear when entering a UITextView as well and it turns out the simulator allows you to toggle between displaying the virtual keyboard and just having you use your laptop's keyboard.
您可以通过以下两种方式在两者之间切换:
You toggle between the two via:
Hardware
> Keyboard
> Toggle Software Keyboard
或按 Cmd + K .
(我的来源: https://stackoverflow.com/a/24401535/1700540 )
因此,请确保您没有误将模拟器切换为仅使用物理键盘! ...像我以前一样
So make sure you didn't mistakenly toggle the simulator to only use your physical keyboard! ... like I had
这篇关于输入UITextField时,iPhone键盘没有出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!