Animated change of contentOffset for case with changing keyboard height
In case you got several UITextField's with different keyboard height (for example username and secure password without iOS hints) switching between them will be a bit jerky. Animation of setContentOffset doesn't affect behaviour in other situation, but fixes this.
This seems to cause a little bounce in the keyboard hide animation when contentInsets is not zero - here's the original behaviour:
https://dl.dropboxusercontent.com/u/6956432/prior.mov
And here's the behaviour with this change:
https://dl.dropboxusercontent.com/u/6956432/new.mov
...Not that I don't think the bounce is kinda cute, but I don't think it's quite right. If the problem you describe happens only when switching between existing fields, could we perhaps only have this new behaviour when the keyboard is already visible? (state.keyboardVisible = YES at method entry)
...Incidentally, to reproduce that, add something like:
self.scrollView.contentInset = UIEdgeInsetsMake(100, 0, 100, 0);
to TPKAScrollViewController.m:23 (at the start of viewDidLoad)
You're right, problem has been a bit deeper. Check out this commit d56b5de98a5671323078f4d14d8b0f96d16c716f.
- Added one
secureTextEntryin demo project, so you can make sure it works perfectly. - Added one more check in
TPKeyboardAvoiding_keyboardWillShow, cause we don't want it invoked when keyboard changes frame to 'out of screen' - Bounces occurred because
UIKeyboardAnimationCurveUserInfoKeyandUIKeyboardAnimationDurationUserInfoKeyofNSNotificationempty while keyboard changes frame
You closed this PR, so I can't add this commit here. I believe if you reopen it - commit will appears here automatically