1

Has anyone tried it? The hardest part for me is to get the height of the UITableViewCell to be the same as that of the UIWebView. By debugging into the code, I noticed that the delegate for UITableViewCell (heightForRowAtIndexPath for getting the height of the cell) is called before the one (webViewDidFinishLoad) for UIWebView is called. Any solution to work around that?

Super thanks!

tom
  • 14,273
  • 19
  • 65
  • 124
  • Have you found any solution to this? I have a situation in which, I have a UItablviewcell with three tabs. All the 3 tabs load uiwebview with different content size. Now, how to resize that cell according to uiwebview contents? – Ruchir Shah Feb 16 '11 at 06:42

1 Answers1

1

I saw this scenario demonstrated once on the iTunesU Stanford iPhone Application Development course. It's shown at the end of lecture 16, from the Spring 2009 sessions

This similar question on SO suggests laying out cells before heightForRowAtIndexPath exits. It would hurt performance for sure, but you could block within that method until the UIWebView is finished loading. Basically loop until the loading property is NO, then return the height of the UIWebView after it is finished.

If you're loading content from the Internet, this might bring your app to a screeching halt, though. If there's any way you can determine the height beforehand, you're better off doing that for performance reasons.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ken Pespisa
  • 21,989
  • 3
  • 55
  • 63
  • Performance is definitely a concern. The Facebook iPhone app must have some tricks to get that work on the News Feed view of the app. I am not planning to use the three20 framework though at this moment. – tom May 11 '10 at 23:40
  • The framework is open source, though. Perhaps there are some ideas you could steal from there? http://github.com/facebook/three20 – Ken Pespisa May 12 '10 at 13:26
  • tried searching for some keywords, quite discouraging. the whole framework is kind of ground up, now easy to understand it from application perspective – tom May 13 '10 at 07:01