Skip to content
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

UITextField text jumps when IQKeyboardManager switches first responder. #217

Closed
FoodworksTeam opened this issue May 19, 2015 · 16 comments
Closed
Labels

Comments

@FoodworksTeam
Copy link

I am using Swift 1.2. Whenever I enter text into a text field and hit the next button on the IQKeyboardManager, the manager works as expected except for an extra jump to the text in the text field that is being resigned. The text moves ~15 pixels above the Textfield, and then flashes back to the expected position.

The text moves out of the frame of the text field for a second. This behavior will only happen once for a given text field. Once it has happened, the text settles back into the TextField and does not jump upon further switching of first responder.

I made sure that my Storyboard file is anchored to the view and not the top layout guide. I also made sure that the sharedManager is enabled in the app delegate.

@FoodworksTeam
Copy link
Author

Also the jump does not happen when the Done Button is pressed.

I was stepping through the KeyboardManager code and could not find anything that would suggest the behavior there. The Manager does not think that the frame has changed or anything.

@hackiftekhar
Copy link
Owner

May be I need to debug swift version. FYI I always suggest developer to use objC version instead of swift because objC version is updated on a regular basis and swift is updated one or two time in quarterly year.

@FoodworksTeam
Copy link
Author

Thanks for the response.

Sorry for being unclear. The IQKeyboardManager code is all Objc. My project is in Swift 1.2.

@hackiftekhar
Copy link
Owner

Ok, will check this weekend

@sokalyambda
Copy link

Confirm this issue!
I also have it, obj-c

@trungnguyen1791
Copy link

I have same issues with my objective c project. (latest version IQKeyboardManager )

@hackiftekhar
Copy link
Owner

I Couldn't find anything regarding the issue when I created a demo to reproduce the same issue, can someone send me the demo project.

@trungnguyen1791
Copy link

This happened to me in this situation:
I have 4 textfields ( using "goNext" function to moves between them). And using "[IQKeyboardManager sharedManager].shouldResignOnTouchOutside = true;"
If you only tap on one text field, type somethings, taps "next" button on keyboard => it work well.

But if you tap on a textfield, type somethings then taps outside to hide keyboard. => The jumps will happened in the next time you tap on that textfield.

@hackiftekhar
Copy link
Owner

Ok, got you. Will try to reproduce in your suggested conditions.

@hackiftekhar
Copy link
Owner

Not able to reproduce with @trungnguyen1791 suggested conditions too, so if someone can provide me demo code then it would be great.

@hackiftekhar
Copy link
Owner

I found that calling 'setNeedsLayout' and 'layoutIfNeeded' from IQKeyboardManager on viewControllers.view causes disorder the internal hierarchy of UITextField when it's border style is UITextBorderStyleNone. Setting 'layoutIfNeededOnUpdate' to NO solve the issue.

FYI from now 'layoutIfNeededOnUpdate is default to NO.

@nathanielescribano
Copy link

i think I'm still seeing this.
After entering info and clicking on8he next field, i see the previous field jump and disapeapr
Event After setting layoutIfNeededOnUpdate to NO

screen recording 2015-10-15 at 05 15 pm

Any thoughts?

@hackiftekhar
Copy link
Owner

Can you please confirm that it's not jumping when library is removed.

@nathanielescribano
Copy link

yup. same code with library removed works as expected (without the autoscrolling of course)

@hackiftekhar
Copy link
Owner

Then please teopen this issue and upload demo project here. I'll try to
debug it.
On Sat, 17 Oct 2015 at 12:30 AM, Nathaniel notifications@github.com wrote:

yup. same code with library removed works as expected (without the
autoscrolling of course)


Reply to this email directly or view it on GitHub
#217 (comment)
.

hackiftekhar added a commit that referenced this issue Jul 12, 2016
hackiftekhar added a commit that referenced this issue Jul 12, 2016
@w-i-n-s
Copy link

w-i-n-s commented May 29, 2017

I have some very close issue: hierarchy and video of issue

In my case it can be solved with clear IQLayoutGuideConstraint in storyboard (between bottom layout guide and UIScrollView) and add
self.scrollView.scrollEnabled = NO; inside textFieldShouldBeginEditing:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants