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

来源:互联网 发布:数据库表设计面试题 编辑:程序博客网 时间:2024/05/05 22:31

碰到了这么个问题,请教了一下同事,一搜这里也有。


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

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.



8
down vote

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];