My UIWebView is shifted up when the keyboard appears, and when the keyboard dismisses, the webview does not come back to its previous position. I've checked out the webview's position before and after the keyboard appears, or dismisses. What a surprise, the webview's frame is not changed. But what I've seen before and after are quite different.
- Before the keyboard appears:
- When the keyboard appears, the webview is shifted up
- When the keyboard dismisses, the webview is not shifted down
What I did so far is applying the following techniques I read from others:
1) observe the keyboard notification, and adjust properly after that
2) Change the meta tag, also add "height=device-height" in the meta tag
3) Change the webview's attributes:
_webView.contentMode = UIViewContentModeScaleAspectFit; _webView.scalesPageToFit = YES; _webView.autoresizingMask = (UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
However, all of these suggestion above do not work. Could you please help me?
Note: I use iOS7, XCODE 5