I've got a UIWebView which is displaying a long chunk of HTML with multiple embedded images that are wrapped in links. The webview is scrollable so that content "below the fold" is accessible.
When the links are tapped, I'm using the webView:shouldStartLoadWithRequest:navigationType:navigationType method to catch a specific JavaScript call, which then triggers a modal load of a UIViewController over the top of the webview.
As soon as the link is tapped, the webview's contentOffset is reset to 0,0, so the page appears to "jump" back to the top. Ideally, I'd like the webView's contentOffset to remain where it is until the modal view controller is dismissed.
I've tried setting the webView.scrollView.scrollEnabled property to NO as soon as the shouldStartLoadWithRequest method is called - this doesn't stop the webView scrolling.
I've also tried saving the contentOffset value at the point where the link is tapped, and then manually resetting it - but again, this doesn't stop the webView from scrolling.
Is there any way of preventing this scrolling from happening??