Get viewport height when soft keyboard is on

后端 未结 7 1871
梦如初夏
梦如初夏 2021-01-31 08:45

I\'ve been trying to make this work for days now, with no luck, so I thought I\'d share info and maybe someone comes up with a solution.

I want to get the exact viewport

7条回答
  •  情深已故
    2021-01-31 09:36

    Just to give you an idea, when the keyboard appears on iOS by default it does nothing on the underlying scrollview.

    If your content is shown in a custom UIWebView, it is up to the programmer to either:

    • Resize the scrollview to avoid getting unreachable content under the keyboard.

    • Adjust the scrollview's content insets (recommended). The scrollview size stays the same but a "border" is added to the bottom so the user can scroll all to all the contents.

    I am not sure how either solution affects the viewport, but your could try both.

    If your web content is being presented by Safari however, Apple adjusts the insets for you.

提交回复
热议问题