4

I am using a WKWebView as my web container on my iOS 8+ hybrid app.

When an input field in the web container is focused and the soft keyboard comes up, the web view scrollview usually scrolls up automatically.

However, sometimes the web view scrollview does not scroll up, and hides the input field behind the soft keyboard. Only when I begin typing into the soft keyboard does the web view scrollview scroll up.

The only solution I can think of is getting the input field position in the web view, and overriding the automatic scrolling provided by iOS. Are there any other solutions?

the 1
  • 111
  • 5

1 Answers1

0

I ran into this issue as well and I was able to solve it by waiting until the keyboard finished animating/sliding up, then taking the height of the element that was focused on, then shifting the screen so that the bottom of that element was a set distance above the top of the keyboard.

It requires a bit of math, but it is doable!

Vemonus
  • 868
  • 1
  • 16
  • 28