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

  • Home
  • SEARCH
  • 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 6943875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:12:47+00:00 2026-05-27T13:12:47+00:00

Question: When I set the rowHeight for UITableView , shouldn’t the height of cell

  • 0

Question:
When I set the rowHeight for UITableView, shouldn’t the height of cell changed as well?
Here is the situation that leads me to think about it:


I want to set a separate line for each table view cell at bottom, what’s more, I want to set the row height for it from 44 to 32. The result I want is like below:

Row height setting is done correctly:

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.tableView setRowHeight:32.0f];
    [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

    //...
}

// Even use the delegate of UITableView
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 32.0f;
}

However, when I was adding separate line for cell, I met a issue: I want to set the separate line at bottom of the cell, so I set the y position by cell.frame.size.height - 1.0f. Unfortunately, the result shown as below:

When I did selecting, cell changed like below:

1. Selected row No.1:

2. Selected row No.2:

3. Selected row No.3:

It seems that the height of cell before selected was 44, when selected, it changed to 32. They were overlapped one by one like cards, right? Weird!

The main code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
        [cell.textLabel setFont:[UIFont fontWithName:@"Futura-Medium" size:15.0f]];
        UIView * seperateLine = [[UIView alloc] initWithFrame:CGRectMake(10.0f, cell.frame.size.height - 1.0f, 300.0f, 1.0f)];
        NSLog(@">>>>>>>>>>>>>>>> %f", cell.frame.size.height);
        [seperateLine setBackgroundColor:[UIColor grayColor]];
        [cell.contentView addSubview:seperateLine];
        [seperateLine release];
    }

    //...
}

I tried to check the cell.frame.size.height, and finally it was 44. And then, I replace the line

UIView * seperateLine = [[UIView alloc] initWithFrame:CGRectMake(10.0f, cell.frame.size.height - 1.0f, 300.0f, 1.0f)];

to

UIView * seperateLine = [[UIView alloc] initWithFrame:CGRectMake(10.0f, 31.0f, 300.0f, 1.0f)];

It worked as the first image shown above. But the cell's height was still 44, they(which we just cannot see totally) ware still overlapped. What I had done is just added a separate line at where y position is 32 but its total height is 44.


So what do you think about this? 😕

  • 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-27T13:12:48+00:00Added an answer on May 27, 2026 at 1:12 pm

    Problem:

    According to apple’s HIG the default tapable area is 44, so by default all control has 44 height.

    you define new UITableViewCell inside

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    

    which is by default 44 and you change nothing in UITableViewCell‘s frame and return it.

    Solution:

    try setting the frame size of the UITableViewCell i.e cell.frame = CGRectMake(0.0f, 0.0f, 320.0f, 32.0f)

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

Sidebar

Related Questions

Old question My understanding is that C# has in some sense HashSet and set
This question is for experiences programmers. Do you have a set process that you
I am creating a survey form that needs to have each question and set
Here's the question: set Pathname = C:\Program Files cd %Pathname% pause The above doesn't
RESOLVED how do i set question to resolved? lol Anyways here is the sollution,
Question: What is the best way to set focus to a web control in
I have a question about how to set up the relations between two models
SHORT VERSION OF QUESTION: So basically my question is: How can I set the
I have to set GridView.DataKeyNames (This is really a question about the syntax for
I've read this question to figure out how to set float:none on an element

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.