1

I have several local html files and I want to show them in a table with static(for now) cells. Each UIWebView would have a different height (I dont want to have any scrolls in the UIWebView) so obviously each cell has a different height. Most of the comments i read discourage the usage of UIWebView in table cells. What do you think : is this applicable ? will it be slow and need time to load?

iosMentalist
  • 3,066
  • 1
  • 30
  • 40
  • i found this answer : http://stackoverflow.com/questions/6626294/displaying-lots-of-richtext-choosing-the-best-option **but i prefer to hear your comments** – iosMentalist Apr 24 '12 at 10:30

2 Answers2

7

UIWebview in tableview cells will affect the performance for sure. To display Html content in tableview cells you can use NSAttributedString.

Community
  • 1
  • 1
Vignesh
  • 10,205
  • 2
  • 35
  • 73
6

I used a UIWebView in an app to display content coming from the web as rows in a table view.

I know that doing that is discouraged, due to the high memory use of UIWebView, but in my case it was not only a matter of displaying rich text: I had to display HTML loaded from the web, so I give that option a try. In short, I tried it and it worked fine.

The app got memory warnings from time to time, but it was also able to recover memory effectively and run unaffected even on an ipod touch (just 256MB of memory). Performance was possibly affected, but due to the fact that the app was doing just that (loading text from the web and displaying it in the table), the app was perfectly responsive.

One important notice: pages were pretty simple, just text, and each table did not contain more than 15 elements. Furthermore, one thing you have to consider is that the UIWebView introduces a small delay in the rendering, so you will have to deal with it and accept it in your app (there is no way to get rid of it that I know of).

In a later project, I used a different approach: using just one UIWebView and creating the table using HTML/js inside of it. Well, it also worked, but I could not see any big improvement as to peak memory usage nor performance (I checked with instruments).

This is just my experience, I am not trying to say that this will work or that is good practice to do. In any case, I hope it helps.

sergio
  • 68,819
  • 11
  • 102
  • 123