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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to