I want to display HTML content inside on my view. Therefore I am rendering the HTML content using webview. The webview is inside a uiscrollview.
Because the HTML changes I need to adjust the height of the webview and the scrollview. I do it this way:
func webViewDidFinishLoad(webView: UIWebView) {
webView.scrollView.scrollEnabled = false
webView.frame.size.height = webView.scrollView.contentSize.height
self.scrollView.contentSize.height = 267.0 + webView.scrollView.contentSize.height
}
But when I running the app this is what happens:
At first it looks great. But when I start scrolling, the webview shrinks to its original size:
Any idea why the webview is shrinking when I start scrolling the scrollview?
I thought that maybe it has something to with constraints. Maybe it tries to revert the height of the webview to it's original height.