Halpo
Halpo

Reputation: 3134

Inserting a UIView header in a UIWebView's ScrollView

Is it possible to have a custom UIView header that is part of the same scroll view as a UIWebView? if so, how could this be implemented?

Upvotes: 1

Views: 838

Answers (2)

Pablo A.
Pablo A.

Reputation: 2052

Create a UIScrollView with the content size of your header + UIWebView.

When doing so, in the delegate of your UIWebView, catch when the web has finished loading and resize the UIWebView according to its content, and make its UIScrollView non-scrollable.

Upvotes: 1

Catalina T.
Catalina T.

Reputation: 3494

If you would need the headerView to move up and down with the webView (like in the mail app on iOS) but, of course, not change it's position when you zoom, it is a bit more complicated than that.

I ran into the same situation and so I put my solution on gitHub, in case someone else needs it :) Here's the project

Upvotes: 3

Related Questions