UIWebView embedded in UIStackView clipping content after rotating

Hi guys,

I have a strange problem in an app that has UIWebViews embedded in a UIStackView. The StackView is embedded in a UIScrollView in order to create an endless carousel, that refreshes content after left/right swipes. The platform is iOS10, the view hierarchy uses autoLayout.

All works fine except for the fact that after rotating the device, the UIWebViews start clipping their content from the right hand side.

I am attaching an image of the IB view hierarchy and screenshot of the iPad showing the web view clipping its content on the right hand side. A black bar appears to be lying on top of the web view’s html content.

I have tested the UIWebView’s frame size and the UIWebView’s scrollView’s frame size, both are stable, they do not change. Hence, both these frames are OK.

I have used a javascript to test the viewport’s width and that seems to be OK as well.

However, there is one strange thing, the viewport is 0.5px wider than the UIWebView’s frame. On iPad, when the webView’s frame size width is 634.5, the viewport’s is 635. Reading the frame size width and adding a html viewport meta tag at that value of 634.5 does not help.

Can this be the issue or is there something else going on? Has anybody run into this issue?

Many thanks in advance!