简体   繁体   English

UITextField键盘解雇行为在iOS 6中有所不同

[英]UITextField keyboard dismissal behaviour different in iOS 6

I have some simple code that moves the 'firstResponder' between UITextFields by calling 'becomeFirstResponder' on each field in turn. 我有一些简单的代码,通过依次在每个字段上调用“ becomeFirstResponder”,在UITextField之间移动“ firstResponder”。

In iOS 5, the keyboard is shown as constantly, until the final textfield where resignFirstResponder is shown. 在iOS 5中,键盘始终显示,直到显示resignFirstResponder的最终文本字段。

However, in iOS 6, the keyboard performs the dismiss and reappear animation each time the first responder is moved. 但是,在iOS 6中,每次移动第一个响应者时,键盘都会执行关闭操作并重新显示动画。 At no point do I call resignFirstResponder when calling becomeFirstResponder to move the responder (or in any of the associated methods) - it just seems to be new default behaviour in iOS 6. 在调用beginFirstResponder来移动响应者(或在任何关联的方法中)时,我绝不会调用resignFirstResponder-这似乎只是iOS 6中的新默认行为。

This is distracting, and unwanted. 这令人分心,并且是不必要的。

I've looked through the Apple documentation, and can't find any mention of a change to how the keyboard animation is managed. 我浏览了Apple文档,找不到关于键盘动画管理方式的任何更改。

Can anyone refer me to documentation of these changes? 谁能推荐我有关这些更改的文档? Thanks. 谢谢。

Found the problem. 找到了问题。

My code was also calling, 我的代码也在调用

[self.tableView reloadData];

...when calling becomeFirstResponder. ...在致电成为firstResponder时。

Therefore, the keyboard was being dismissed while the redraw occurred. 因此,重绘发生时正在关闭键盘。

This certainly seems to cause different keyboard behaviour between iOS 5 & 6. Though the behaviour in 6 doesn't seem wholly unreasonable, considering. 当然,这似乎会导致iOS 5和6之间的键盘行为有所不同。尽管考虑到6中的行为似乎并不是完全不合理的。

Thanks to @Fogmeister for the help. 感谢@Fogmeister的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM