开发者

Text formatting issue in UIWebview?

I've a webview which is placed inside a custom table view cell, since dynamic data is to be loaded in to this webview, some text gets cut off as per current webview frame.

So I'm asking is there any method to dynamically set size of webview so as to see just first two lines of webview content.

Thanks in a开发者_运维知识库dvance.


Here is the very nice article with code example, Just check how do they taking care of the same issue, which you are facing.

Fast UITableViewCell with a UIWebView

Implement the heightForRowAtIndexPath menthod of UITableViewDelegate, and get the text of two line.

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

Try with below to get the height for one line.

float lineHeight = [myText sizeWithFont:myTextFont ].height; // Calculate the height of one line.

Multiply it with 2 and assign it as your row height.. :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜