开发者

UIWebView inside a UITableViewCell

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 f开发者_C百科or 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜