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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:04:59+00:00 2026-06-06T19:04:59+00:00

I set the UIwebview as a header in UITableview . UIWebview height and width

  • 0

I set the UIwebview as a header in UITableview.UIWebview height and width are dynamic.Its come for local html files.

UIWebview and UITableview are under one scroll.

It works fine for iphone.Same method I wrote for ipad it works good.but one problem is there.
In ipad Header view and table view alignment is not proper .

Here is code.

Rootviewcotrollor is UITableviewControllor

Rootviewcontroller.m

 - (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Webview in UITableView";
webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 10)]; // Don't use CGRectZero here, won't work
webview.delegate = self;
webview.hidden = YES;

[webview loadRequest:[[NSURLRequest alloc] 
                      initWithURL: [NSURL URLWithString:@"http://www.google.com/"]]];

[self.tableView setTableHeaderView:webview]; // Leave this, else you'll have rows to fill the rest of the screen

}

- (void) webViewDidFinishLoad:(UIWebView *)webView {
float newSize = [[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.scrollHeight"] floatValue];
NSLog(@"Resizing webview from %.2f to %.2f", webView.frame.size.height, newSize);
webView.frame = CGRectMake(webView.frame.origin.x, webView.frame.origin.y, webView.frame.size.width, newSize);
webView.hidden = NO;

// We need to reset this, else the new frame is not used.
[self.tableView setTableHeaderView:webview];

}

For same code iphone output

enter image description here

And iPad output UITableview start slider ahead of the UIWebview.

enter image description here

I try to set frame of header but it’s not working,it give webview and table view both have it’s own scrollview which not needed.

What is solution for it?

Thank you.

  • 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-06T19:05:02+00:00Added an answer on June 6, 2026 at 7:05 pm

    Its a grouped table view that’s why its alignment is not proper cause grouped table view takes some default size from x-origin and y-origin always… you can use plain table or set x of grouped table or increase x-origin of web view..

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

Sidebar

Related Questions

I am loading an html file to uiWebView and getting variables that were set
I have a UIWebView and I want to set one of it's text field
I have set scalesPageToFit property to YES for UIWebView. Its getting zoom , but
I have the following code for my application. - (void)webViewDidFinishLoad:(UIWebView *)webView { //Set the
In a UIWebView of my iPad application, I display a HTML file with a
I have a UIWebView which I want to put under my translucent UINavigationBar. Normally
I have a UIWebView (that has been sized to fully contain the html) and
I'm using html/javascript with iOS and UIWebView. I want to invoke an objective-c method
so I have UIWebView in my application and I load some html (article) to
I set a custom button that executes a goBack method of uiwebview. However, I

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.