UIWebView height calculation
UIWebView height calculation
- Subject: UIWebView height calculation
- From: Dragos Ionel <email@hidden>
- Date: Mon, 7 Sep 2009 22:16:06 -0400
Hi,
1. I am trying to find how much text fits in a UIWebView of a certain
size (let's say 320x400).
For this, I am using a UIWebViewDelegate in the following way:
- (void)webViewDidFinishLoad:(UIWebView *)webView{
//...
CGSize size = [webView sizeThatFits:CGSizeZero];
int h = size.height;
if(h<=maxHeight) {
//add another character to the string htmlContent
...
} else {
//reached the maximum height, do nothing
return;
}
[webView loadHTMLString:htmlContent baseURL:[NSURL URLWithString:@""]];
}
Is it a good idea to call loadHTMLString from a delegate?
The delegate is supposed to run in a different thread than the main one
2. Is there a simpler way to find how much content can fit in a UIWebView?
Thanks a lot,
Dragos
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden