RDRStickyKeyboardView icon indicating copy to clipboard operation
RDRStickyKeyboardView copied to clipboard

Fixing custom contentInsets

Open fjcaetano opened this issue 10 years ago • 5 comments

Showing and hiding the keyboard breaks custom contentInsets for the tableView.

fjcaetano avatar Jul 23 '14 00:07 fjcaetano

I haven't tested myself yet but are you sure this works? It doesn't seem to be a good idea to increment the contentInset because this will cause the contentInset to grow indefinitely when the method is called over and over again.

datwelk avatar Jul 24 '14 11:07 datwelk

I understand your skepticism, but it is working. You are forgetting that I also changed the multiplier for the bottomInset:

bottomInset *= RDRKeyboardIsFullyHidden(keyboardFrame) ? -1 : 1;

The problem with the current implementation is that you add to the contentInset the height of the keyboard, but when it's dismissed, you don't subtract it back. You are setting something based on the size of the view, disregarding that it may have a custom contentInset setted.

fjcaetano avatar Jul 24 '14 13:07 fjcaetano

I've tried as well, and as @datwelk was saying, it will make the contentInset to grow indefinetely

thepelican avatar Jul 25 '14 08:07 thepelican

Then I cannot merge this ^^. Maybe we can check scrollView's initial contentInset inside the initWithScrollView method of RDRStickyKeyboardView. This will however not work if the scrollView's contentInset is changed afterwards.

datwelk avatar Jul 25 '14 09:07 datwelk

The project has no tests, but let me see if I can poke around more and try duplicating the issues you're mentioning.

fjcaetano avatar Jul 25 '14 13:07 fjcaetano