My app is in portrait mode showing a webView, and now I try to handle orientation. Therefore, in my orientation handler (from portrait --> landscapeRight, for example), I try to rotate the webView & change the width to fill the width of the screen like this:
webView.rotation = 90 webView.x = newX webView.y = newY webView.width = newWidth -- the width of landscape screen
The webView does rotate correctly. If I don’t change its width, the webView is positioned correctly at (newX, newY)
But if I try to change its width (the 4th line, webView.width = newWidth), there are two problems:
(1) The webView is not positioned correctly (seems positioned in the middle)
(2) The webView width does not change. And the web page in the webView seems getting “zoomed” instead.
Please help. How to change webView width correctly in order to handle orientation changes?
P.S. The behaviors shown above are tested with iPhone 5S. Simulator behaves differently.