hackiftekhar / IQKeyboardManager

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.
MIT License
16.43k stars 2.4k forks source link

Textview not scrolling properly when keyboard appears #842

Closed rlaurb closed 7 years ago

rlaurb commented 7 years ago

IQKeyboardManagerSwift. The IQKeyboardManager is enabled in AppDelegate, but no other code changes were implemented.

I have a UISplitViewController. The detail view contains a UINavigationView.

Two cases:

  1. Standard Implementation: The scene contain a UIView which contains the UITextView in question. In this case, tapping in the UITextView causes the keyboard to appear, and the entire view (including navigation bar) to scroll upwards. The tapped location is visible above the keyboard toolbar.

  2. Changed the class of the UIView to UIScrollView. In this case, tapping in the UITextView causes the keyboard to appear, and the text view scrolls (leaving the Navigation Bar visible (which is what I want). However, the text view does not scroll enough. The new insertion point in the UITextView is still hidden behind the keyboard's toolbar (by an amount which appears to be roughly equal to the height of the toolbar).

I've included the storyboard.

If this is my problem, please let me know what to do to fix it.

Main.storyboard.zip

Thanks,

Rick Aurbach

rlaurb commented 7 years ago

More information: In the case where the UITextView is contained in a UIScrollView (and tapping in a portion of the text view that will be hidden by the keyboard, it appears that the calculation of how far to move does not account for the height of the keyboard's toolbar (i.e., the TextView's inputAccessoryView).

rlaurb commented 7 years ago

I have verified that this issue is not due to the existence of the inputAccessoryView, because I can set IQKeyboardManger.sharedManager().enableAutoToolbar = false and the problem persists.

The enclosed screenshot shows the keyboard present, but the textview not properly scrolled... simulator screen shot may 5 2017 11 56 47 am

rlaurb commented 7 years ago

Sorry, closed this by accident.

Venkat1128 commented 7 years ago

I have a same problem , @rlaurb please let me know if you find the solution.

Thanks, Venkat

rlaurb commented 7 years ago

Venkat,

It took me a while to realize it, but the solution was actually documented in the document “MANUAL MANAGEMENT.md”. Look at the section entitled “Working with Full Screen UITextView” and follow those instructions. The setting of constraints is pretty obvious, but the key is the following sentence:

"Connect bottom layout guide constraint with IQLayoutGudeConstraint and that’s all.”

To do that, you need to burrow down into IQUIViewController+Additions.swift to make the connection. See the attached screenshot.

Connecting the bottom of the textView to the bottom layout guide AND IQUIViewController_Additions:IQLayoutGuideContraint is absolutely key to making this work.

Cheers,

Rick Aurbach

On Jun 12, 2017, at 7:54 AM, Venkat Kurapati notifications@github.com wrote:

I have a same problem , @rlaurb https://github.com/rlaurb please let me know if you find the solution.

Thanks, Venkat

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hackiftekhar/IQKeyboardManager/issues/842#issuecomment-307780592, or mute the thread https://github.com/notifications/unsubscribe-auth/AGTdES1bdlh8nC1_oB382YpIfYUxdTcTks5sDTT_gaJpZM4NNZcH.