UITableViewCell 中的 TextField 键盘不会消失
我的 iOS 键盘有一个奇怪的问题。
在我的应用程序中,我在一些 UITableViewCells 中使用 UITextFields。如果当前文本字段失去焦点,我想关闭键盘。
这是我到目前为止所做的:
设置
并将 [textField resignFirstResponder] 添加到 textFieldDidEndEditing:->
textFieldDidEndEditing
被调用,但键盘保持不变。将所有 TextField 添加到数组,循环遍历所有对象并调用 resignFirstResponder
- < p>->;没有效果
在textFieldDidEndEditing内调用了[
self.tblView endEditing:YES
]。- ->键盘并没有消失。
但是使用“完成按钮”关闭键盘效果很好(使用 textFieldShouldReturn
)
我做错了什么?
编辑:我制作了一个关于我的问题的视频:http://www.youtube.com/watch ?v=Zuz5rCv2GCo
I have a strange problem with the iOS Keyboard.
In my app, I am using UITextFields inside some UITableViewCells. I want to dismiss the keyboard if the current textfield loses its focus.
This is what I've done so far:
Set up the
<UITextFieldDelegate>
and add [textField resignFirstResponder] to textFieldDidEndEditing:->
textFieldDidEndEditing
gets called, but the keyboard stays.Added all TextFields to an array, looped through all objects and call resignFirstResponder
-> No effect
Called [
self.tblView endEditing:YES
] inside textFieldDidEndEditing.- -> Keyboard didn't disappear.
But dismissing the keyboard by using the Done-Button works perfectly (using textFieldShouldReturn
)
What am I doing wrong?
Edit: I've made a video of my problem: http://www.youtube.com/watch?v=Zuz5rCv2GCo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试执行以下操作:
try implementing following: