hackiftekhar/IQKeyboardManager

UITextField in subview keep being hidden by the keyboard

BoilingLime opened this issue · 3 comments

I put two UITextField in a subview to be able to perform action on both UITextField. But the keyboard keep to overlay the view and to hide the text fields.

This is a link to a video of the issue :
https://www.youtube.com/watch?v=WBGBayq35R8&feature=youtu.be

Or could it be the auto layout constraints which messing up everything ?

This may be autolayout, but In my knowledge, the library is not depend on autolayout or autoresizing. It works in both configuration. So could you please share a demo project so I'll be able to debug the issue and update the library accordingly.

Here is a demo project where you can test the bug :
https://www.dropbox.com/s/en174cnhtpnv63f/DemoForIQKeyborad.zip?dl=0

I found that IQKeyboardManager is doing his work perfectly, but your auto layout configuration is incorrect.

Issue:-
I found that the logo UIImageView’s top is pinned with topLayoutGuide.

When the MyViewController.view’s frame is updated by IQKeyboardManager, for example frame is updated from (0,0,320,568) to (0,-82,320,568) to show textField properly, then the UIImageView’s top forces self to not move and keep 38 distance with topLayoutGuide, and UIImageView also forces the bottom UIView to move down(Bottom UIView's top is pinned with UIImageView's bottom) . So the result is shown like buggy animation with NO change in screen, althought main view is moved upside but all it’s content is moved downside.

Solution:-
You can remove UIImageView’s top pinned with topLayoutGuide and pin it with it’s superView.

Guide to AutoLayout:-
For proper understanding and use of topLayoutGuide please refer this guide.

http://www.doubleencore.com/2013/12/reconciling-ios-6-ios-7-using-interface-builder/

Thanks
Iftekhar