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

The Archive Base Latest Questions

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

I have created a UITableview with custom UITableViewCell .The UITableViewCell contains UILabels and I

  • 0

I have created a UITableview with custom UITableViewCell.The UITableViewCell contains UILabels and I have calculated the height of each cell based on the cells height.But how can I get the tableview height?Because based on the tableView’s height I need to calculate
the height of scrollView
I have created a UITableView like this when a button is clicked:

-(IBAction)btnClicked:(id)sender
{
    self.tableView=[[UITableView alloc] initWithFrame:CGRectMake(0,150,327,[arr5 count]*205) style:UITableViewStylePlain];
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
    self.tableView.scrollEnabled = NO;
    [self.view addSubview:self.tableView];
    float fscrview = 150 + self.tableView.frame.size.height + 20;
    testscroll.contentSize=CGSizeMake(320, fscrview);
  }
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  NSString *city1 = city.text;
        UIFont *font = [UIFont fontWithName:@"Helvetica" size:14.0];
        CGSize constraintSize = CGSizeMake(280.0f, MAXFLOAT);
        CGSize bounds = [city1 sizeWithFont:font constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap];
//similarly calculated for all 
   return (CGFloat) cell.bounds.size.height + bounds.height+bounds1.height+bounds2.height+bounds3.height+bounds4.height+bounds5.height;
  }

I am able to get tableViewCells height through this.How do I calculate/set the overall tableView’s height after this?

And how to calculate ScrollView’s height based on tableView’s row/height?

  • 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-16T19:04:37+00:00Added an answer on June 16, 2026 at 7:04 pm

    Use contentSize.height property of UITableView.

    I think you want to set the whole tableview with content size and then set the scrollview size related content of UITableView and for this use bellow code…

    After add data or reloadData in UITableView just set bellow code..

        yourTableView.frame = CGRectMake(yourTableView.frame.origin.x,yourTableView.frame.origin.y, yourTableView.frame.size.width, yourTableView.contentSize.height);
    
        float ftbl = yourTableView.frame.origin.y + yourTableView.contentSize.height + 15;
        yourScrollView.contentSize=CGSizeMake(320, ftbl);
    

    UPDATE:

    self.tableView=[[UITableView alloc] initWithFrame:CGRectMake(0,150,327,[arr5 count]*205)style:UITableViewStylePlain]; 
    self.tableView.delegate=self; 
    self.tableView.dataSource=self;
    
    [testscroll addSubview:self.tableView]; /// add this tableview in scrollview not in self.view
    [self.tableView reloadData];
    self.tableView.frame = CGRectMake(self.tableView.frame.origin.x, self.tableView.frame.origin.y, self.tableView.frame.size.width, self.tableView.contentSize.height);
    float ftbl = self.tableView.frame.origin.y + self.tableView.contentSize.height + 15; 
    testscroll.contentSize=CGSizeMake(320, ftbl); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a UITableView with a custom UITableViewCell . My cell includes one
I have created a custom UITableViewCell , but when I dequeue the cell, sometimes
i have created a custom UITableViewCell , but when I dequeue the cell, sometimes
I have a grouped UITableView with custom cells (created by subclassing UITableViewCell ). I
I have created a custom cell that contain a Label but when I added
I have created a custom UITableViewCell which is composed by 2 UILabels and a
I created a custom cell with IB In my interface, I have 3 UILabels
I have created Custom UITableViewCell using XIB file and got it working in UITableView.
I have a UITableView with a custom UITableViewCell that I created in the InterfaceBuilder.
I've got a little problem in my UITableViewCell. Each Custom Cell have an UISwitch

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.