Problem
I want to display an image and Html text on the app screen. The text is large so it may not fit on a screen so I want the content to be scrollable. WebView
by default has scroll functionality for content going beyond screen size. But I don't want just the text to move upwards as I scroll down but also the image to move upwards i.e. I do not want the image to stick around on the screen when I scroll downwards.
One simple solution for this is to have the image rendered within the html content, but I do not want to do that because ImageView allows me additional functionality that I want to use.
Possible solution
The solution I tried for this was having an ImageView
and a WebView
within a ScrollView
but when I try implementing it, only the webview content is scrolling and the image is fixed. (This is possibly because the WebView
's scroll is getting preference over the parent ScrollView
's scroll. I even tried setting WebView's child scroll view's delegate to outer scroll View but that didn't help and html text was not scrollable at all after build:
webview.scrollView.delegate = self.scrollView
How can I solve the problem of combined scrolling for ImageView
and content in WebView
possibly using other container views (if necessary)?