[UITableView] - Display a list of html content with image data

My application has once feature: display a list of html content (We are using UITableView)

Problem is how to calculate exactly height for any cell base on html content display size.

=> my solution is: using an UIWebview inner every UITableViewCell to display content.

With once cell, waiting for finishing loading html content (webViewDidFinishLoad delegate). After that, use UIWebview's scrollWidth, scrollHeight (by [[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.scrollHeight"] floatValue])

to indicate content display size.

=> save this crollHeight to database.

=> reload cell that has been finished loading.


In the next time reload cell, scrollHeight will be used for indicating return value in heightForRowAtIndexpath and calculate view frame in cellForRowAtIndexPath.

The problem is similar to resolved, but we have the second problem.

Incase network connection is so slow, and if we have img html tag in cell's html content (img src is url from another server) , content size could not be calculate exactly by UIWebview scrollHeight. We could see only a part of image in html img tag.


Is there anything wrong in my solution. May everyone have any suggestion for better solution, please help me.


Thanks very much!

[UITableView] - Display a list of html content with image data
 
 
Q