Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8424129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:54:20+00:00 2026-06-10T03:54:20+00:00

I am add UIWebView in View and That view in ScrollView. I want to

  • 0

I am add UIWebView in View and That view in ScrollView.

I want to get frame of the UIWebView Content. So can I set the frame to view and scrollview?

I know we can get the height by using javascript. As mention below:

float height = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] floatValue];

But when I am rotating the view and recalculate the height of the UIWebView content in didRotateFromInterfaceOrientation::(UIInterfaceOrientation)fromInterfaceOrientation method, then content height was increased.

So please suggest me how can I get the proper height when i am rotate the orientation?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:54:21+00:00Added an answer on June 10, 2026 at 3:54 am

    Adopt this method:

    - (void) webViewDidFinishLoad:(UIWebView *)webView{
        CGRect frame = wvContent.frame;
        CGSize fittingSize = [wvContent sizeThatFits:CGSizeZero];
        frame.size = fittingSize;
        wvContent.frame = frame;
    }
    

    Then call this method everytime device rotating:

    - (void) reloadContent
    {
        CGRect frame = wvContent.frame;
        frame.size.height = 1;
        frame.size.width = wvContent.frame.size.width; // you should change webview's width here.
        wvContent.frame = frame;
    
        [wvContent loadHTMLString:yourHTML baseURL:nil]; // reload webview
    }
    

    Hope that help 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add padding on UIWebview using Javascript, because I switch the view
I set the content of a UIWebView using loadHtmlString: . I don't add them
I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but
i want to add map cluster in my UIWebView using google map api but
I want to add text from my database to a UIWebView, but I have
I'd like to add a header view to an UIWebView similar to the address/search
I want to embed an UIWebView into my MonoTouch application for an area that
I'm using a UIWebView like that in the viewDidLoad: webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,
I'm modifying some code that I've been left with and want to add some
I have an UIWebView with and using QuartzCore to add some style to this.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.