• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UIWebView height calculation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: UIWebView height calculation
      • From: Alex Kac <email@hidden>
  • Prev by Date: Re: Strangest UITable bug
  • Next by Date: Re: UIWebView height calculation
  • Previous by thread: Re: Strangest UITable bug
  • Next by thread: Re: UIWebView height calculation
  • Index(es):
    • Date
    • Thread