Skip to content

Animated change of contentOffset for case with changing keyboard height #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kohtenko
Copy link

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.

@michaeltyson
Copy link
Owner

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)

@michaeltyson
Copy link
Owner

...Incidentally, to reproduce that, add something like:

self.scrollView.contentInset = UIEdgeInsetsMake(100, 0, 100, 0);

to TPKAScrollViewController.m:23 (at the start of viewDidLoad)

@kohtenko
Copy link
Author

You're right, problem has been a bit deeper. Check out this commit d56b5de.

  • Added one secureTextEntry in 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 UIKeyboardAnimationCurveUserInfoKey and UIKeyboardAnimationDurationUserInfoKey of NSNotification empty 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

@michaeltyson michaeltyson reopened this Aug 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants