如何摆脱 iPhone 模拟器中的键盘?
我正在制作一个简单的 iPhone 应用程序,其中我有一些文本字段,一个在另一个下面。 问题是当我通过模拟器中的键盘将数据添加到前几个字段时, 键盘也会弹出,我没有使用它来打字,因为我仍在使用模拟器而不是实际的手机。 现在我无法在键盘隐藏的文本字段中输入数据。
抱歉,如果我的问题很愚蠢,可能有一个捷径, 但我是新人,当我在 Google 搜索上找不到东西时,StackOverflow 是我唯一的选择:)
I am making a simple iphone application where I have certain textfields one below the other.
the problem is when I am adding data into these first few fields via my keyboard in the simulator,
the keypad also pops-up which I am not using for typing as I am still using the simulator not the actual phone.
Now I can't type data into textfields hidden by the keypad.
Sorry If my question is silly, there could be a shortcut for that,
But I am new and StackOverflow is my only back option when I can't find things on Google search :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
使用模拟器键盘输入用户输入并编写代码以向上移动文本字段,以便键盘不会隐藏文本字段。将委托连接到文本字段。
我用它来上下移动:在视图中确实加载了,
以及以下方法
Use your simulator keypad for entering the user inputs and write code for moving up the textfields so that keypad doesn't hides the text fields. Connect the delegate to text fields.
I am using this for moving up and down: in view did load,
and the following methods
只需添加 textField 委托...这是它的委托方法
设置您的所有 textFiled 像上面一样。您的键盘将被解雇。我建议将文本字段保留在滚动视图中。它可以帮助你
Simply Add textField Delegate.. AND This IS Its Delegate Method
Set Your all textFiled Like above. Your Keyboard will Be Dismissed. And I suggest To keep Your Textfields In Scrollview. It helps You
您可能正在寻找类似 Android 中的“后退按钮”之类的东西,它在任何情况下都会关闭 Android 模拟器上的键盘。在 iOS 模拟器中,您没有像这样工作的快捷方式或按钮。您将能够使用返回按钮关闭键盘,但前提是您已连接 UITextFieldDelegate 首先在您的代码中。 使用此代码返回按钮“工作”。
You're probably searching for something like the "Back Button" in Android, which dismisses the keyboard on the Android Emulator in any case. In the iOS Simulator you don't have a shortcut or button which works like that. You will be able to dismiss the keyboard with the return button, but only if you have hooked up an UITextFieldDelegate in your code first. Use this code to make your return button "work".
或者,您可以从属性检查器添加 RETURN 键(完成,执行...)。
Alternativly you could Add a RETURN key(DONE,GO...) from The Attributes Inspector.
我正在使用以下答案来解决这个问题。希望这对您有帮助。
您只需在视图控制器.m 文件中使用此代码
I am using the following answer to solve the problem.I hope this is really helpful to you.
You simply using this code in your view controller.m file