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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:45:36+00:00 2026-06-14T03:45:36+00:00

I have a uiwebview that loads data using the loadHtmlString function.The thing is i

  • 0

I have a uiwebview that loads data using the loadHtmlString function.The thing is i am loading the data from an sqlite database, each time i load a different string with different length and naturally the web view obtains different height.
Now i need to know each time the exact height of the uiwebview in order to load an imageView right under the webView.
I have tried

- (void)webViewDidFinishLoad:(UIWebView *)aWebView {
    CGRect frame = aWebView.frame;
    frame.size.height = 1;
    aWebView.frame = frame;

    CGSize fittingSize = [aWebView sizeThatFits:CGSizeZero];
    frame.size = fittingSize;
    aWebView.frame = frame;

    NSLog(@"Size: %f, %f", fittingSize.width, fittingSize.height);
}

but i always get the same result. I need to know how can i get dynamically the height of web view each time it is loaded. Thx

  • 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-14T03:45:37+00:00Added an answer on June 14, 2026 at 3:45 am

    This wasn’t the right approach to handle this situation; instead of loading the image in an image view and having to keep always in mind the height and width and all that stuff…The easiest and most reliable solution was just to load the image inside the html string and that’s it ! Just be sure of the baseURL as so and everything will be ok no matter what orientation you take :

     NSString* extension = @"gif";
        NSString* strRR = [NSString stringWithFormat:@"%@.%@", authorNAme2,extension];
        NSString *path = [[NSBundle mainBundle] bundlePath];
        //NSLog(@"This is the path %@", path);
        NSURL *baseURL = [NSURL fileURLWithPath:path];
        //  NSLog(@"this is the base URL %@",baseURL);
    
        NSString *cachePath = [NSString stringWithFormat:@"%@/%@", path,strRR];
    
                NSString * htmlString = [NSString stringWithFormat:@"\
                                         <html>\
                                         <table width='100%%'>\<tr>\<td>\
                                         <body>\
                                         <p style = 'font-size:30px;'> %@ <\p>\
                                         </td></tr><tr><td><br></td></tr><tr><td align ='center'><br><img src='%@' width='60%%' \></td></tr></body>\
                                         </table>\
                                         </html>",authorNAme , cachePath];
    
    
    
                //          NSString *selection = [WebV2 stringByEvaluatingJavaScriptFromString:@"window.getSelection().toString()"];
                //          NSLog(@"*/*/*/*/**/*/*/*/*/*/*//*/ This is your selection mate %@" , selection);
    
    
    
    
                WebV.opaque = NO;
                WebV.backgroundColor = [UIColor clearColor];  
                [self.WebV setScalesPageToFit:YES];
                [self.WebV loadHTMLString:htmlString baseURL:baseURL];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have the following code that loads a UIWebView from another View. Now
I have a native iPhone app that just loads a website using UIWebView .
I have a UIWebView that loads a local HTML file from the resources folder.
I have a UIWebView that loads text from an htmlString . I need when
I have a UIWebView that loads a link, http://www.google.com/a/datacommsales.net . But I want to
I have a UIWebView that loads a website. Then in - (void)webViewDidFinishLoad:(UIWebView *)webView I
I have a view with a bottom toolbar and a UIWebview that is loading
I'm loading in a UIWebView from another class, and that works great. But now
I have an application that is loading html from a remote server in a
I have a UIWebView that loads a YouTube video. The problem is, that if

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.