How to add subview to a webview so that the subview would scroll along with webview?

Akshay Shah picture Akshay Shah · Jul 27, 2010 · Viewed 7.1k times · Source

I have webview.

Now I want to add a subview to it. I added it using addsubview method.

The view got added, but did not scrolled with webview.

I want my subview to be scrolled with the webview.

How can I do that?

Regards, Akshay.

Answer

ciryx picture ciryx · Feb 13, 2012

You simply need to add your subview to the UIScrollView of the UIWebView like this to have your subview scroll with the webview content:

[webView.scrollView addSubview:youSubView];