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 7627737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:30:00+00:00 2026-05-31T05:30:00+00:00

I am new to UIWebView and especially stringByEvaluatingJavaScriptFromString method. In my layoutSubviews, I am

  • 0

I am new to UIWebView and especially stringByEvaluatingJavaScriptFromString method.
In my layoutSubviews, I am calling my webview to get the frame size.

 [self.body setFrame:CGRectMake(10.0f,10.0f,320.0f,[[_body stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] floatValue])];

It tries to find the height but leaves lots of space in the view meaning it does not give the correct height with text string.
Now the above code works perfectly on iOS 4 and it does not work on iOS 5.

Is there any other way I can change the following to get it work on iOS 5 ?

  • 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-05-31T05:30:01+00:00Added an answer on May 31, 2026 at 5:30 am

    First, evaluate your javascript on its own:

    NSString* result = [_body stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"];
    NSLog(@"My JS is returning %@",result);
    

    Make sure this is providing the correct value. I believe the JS engine was modified from 4.0 to 5.0 so it may be handling it differently.

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

Sidebar

Related Questions

is there any way to get informed, when a UIWebview has loaded a new
I'm getting the new size of a UIWebView threw its delegate = #pragma mark
For some reason, I cannot get a UIWebView to play nice with my new
New Question I am looking for a way in Javascript to get the parent
Every time I load a new page with UIWebView the before loaded page is
I'm using UIWebView to display text via the method: loadHTMLString:baseURL The HTLMSting is created
How can I tell my UIWebView to open links in a new View ,
This may sound a newbie question, however I'm new to iOS dev, I've UIWebView
I am trying to push in a new view controller with the code: [self.navigationController
I am trying to resize a UIWebView like this: CGRect oldFrame = zoomView.frame; zoomView.layer.anchorPoint

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.