iPhone 键盘不会隐藏在设备上
我的 iPhone 键盘有问题。尝试遵循该网站上发布的几条建议,但没有成功。
我实现了两个 UITextField,每个 UITextField 都显示一个带有 UIPickerView 的操作表。我想做的基本上是显示操作表并隐藏键盘。为此,我创建了以下方法:
- (IBAction) closeScreenKeyboard:(id)sender
{
[txtSize resignFirstResponder];
[txtColour resignFirstResponder];
}
我使其通过以下事件触发:两个 UITextField 的编辑已开始。
所以我的逻辑执行以下操作:在选择 txtSize 或 txtColor 时,Editing Did Begin 会触发两个操作:closeScreenKeyboard 和 showActionSheet。
有趣的是,在 iPhone 模拟器上,这工作得很好,但当我在设备上尝试时,键盘仍然在那里。
有人可以发布此问题的任何修复吗?
I have a problem with the iPhone keyboard. Tried to follow several suggestions posted on this site but with no success.
I implemented two UITextFields each of which showing an action sheet with a UIPickerView. What I want to do is basically show the action sheet and hide the keyboard. To do this, I created the following method:
- (IBAction) closeScreenKeyboard:(id)sender
{
[txtSize resignFirstResponder];
[txtColour resignFirstResponder];
}
which I made it to trigger by the following event: Editing Did Begin, of both UITextFields.
So my logic does the following: On selecting either txtSize or txtColor, Editing Did Begin triggers two actions, closeScreenKeyboard and showActionSheet.
Funnily enough, on the iPhone simulator this works perfectly but when I try it on a device, the keyboard remains there.
Can someone please post any fixes to this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个名为的方法
,它执行以下操作:用于使视图或任何作为第一响应者的子视图辞职(可选强制)
我认为您应该尝试这个,我认为您应该首先隐藏键盘,然后显示操作表。
There is a method called
which does the following: use to make the view or any subview that is the first responder resign (optionally force)
I think you should try this and I think you should first hide the keyboard and then show the actionsheet.