Home / IOS Development / How do you put a web view in a scroll view like in the Mail app? : iOS Programming

How do you put a web view in a scroll view like in the Mail app? : iOS Programming

I want to create something like the iOS mail app’s mail delivery controls. The one that appears when you click on an email.

It has 3 components:

  1. From to

  2. Email Subject

  3. Web view

My current method uses only one WKWebView. I want to add one impression as the subject line of the email above the web view and another below it.

There are three approaches I can think of to do this:

  1. Table view with web view inside the cell. This gets very messy because it is a scrolling view in a scrolling view. My class also contains lots of references to the web view, and using a table view cell will limit the code to only inside the cellForRowAt method. My cells cannot be reused, so I can not really see the point in using this.

  2. Scroll view with web view and normal view. This is also a bit messy because there is a scrolling view inside a scrolling view. I’m not very familiar with scrolling views, so I’m not sure if I’ll be able to declare the content (web view) in my view controller class.

  3. Place a UIV view on top of the web view. Do this where the upper limit of UIView changes while browsing. I think this is a terrible method. The e-mail app definitely does not use this because the subject view is portable, so it is definitely in a kind of scroll view.

Any ideas on what the best approach would be?

Edit: My web view can change height, since many sections can be expanded. I can not set a fixed height for it.

Source link