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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:37:09+00:00 2026-05-22T11:37:09+00:00

I am trying to resize my UITableViewCell’s frame via: [cell setFrame:CGRectMake(cell.frame.origin.x, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height+25)];

  • 0

I am trying to resize my UITableViewCell's frame via:

 [cell setFrame:CGRectMake(cell.frame.origin.x, 
                           cell.frame.origin.y, 
                           cell.frame.size.width, 
                           cell.frame.size.height+25)];

however, it’s not resizing after I do this… why is this?

This is weird as if I add a UIToolBar into the cell, it resizes but when I am adding a UIView, it doesn’t:

[cell.contentView addSubview:sideSwipeView];
  • 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-22T11:37:10+00:00Added an answer on May 22, 2026 at 11:37 am

    Here’s the long and short of it:

    1. Your cell width is determined by the width of the tableview it’s in.

    [EDIT: If it’s a grouped table view, the cell is 20 – 60 pixels narrower than the tableview width, depending if you’re using an iPhone, or an iPad.]

    1. Your cell height is determined by the heightForRowAtIndexPath method.

    If you’re manually setting the cell’s frame, it’s going to be useless except when you’re using a subclassed cell where you want to add subviews based on the cell’s dimensions.

    Even in this case, it’s recommended to get the cell’s frame from the tableview by using rectForRowAtIndexPath:(NSIndexPath*)indexPath method and then setting that frame as the cell’s frame (after setting the frame’s origin Y as 0).

    I’m not quite sure about the UIToolBar, but your subview’s frame won’t change on changing the cell frame.

    Maybe if you could tell us what you’re trying to achieve, we can suggest a solution for you?

    ——————–EDIT——————–

    So you need to dynamically add a subview to a cell on tapping it and resize it’s height according to the new subview. This is gonna get hairy so here goes:

    In your .h file declare:

    BOOL subviewAdded;
    

    In your .m file, in the init, do:

    subviewAdded = NO;
    

    Let’s assume that you want the cell’s height to be 50 without the subview and 100 with the subview. Accordingly, your heightForRow method should be:

    - (CGFloat)tableView:(UITableView *)tableView 
               heightForRowAtIndexPath:(NSIndexPath *)indexPath {
        return (subviewAdded?100.0f:50.0f);
    }
    

    This means that initially since subviewAdded is NO, all your cells will have the smaller height.

    Now, to add a subview to a cell on tapping it, and to change it’s height dynamically, do this in your didSelectRow method:

    - (void)tableView:(UITableView *)tableView 
            didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        //Get the cell at this indexPath
    
        UITableViewCell *thisCell = [tableView cellForRowAtIndexPath:indexPath];
    
        if(subviewAdded)
        {
            subviewAdded = NO;
    
            for(int i = 0; i < [thisCell.contentView.subviews count]; i++)
            {
                UIView *thisSubview = [thisCell.contentView.subviews objectAtIndex:i];
                [thisSubview removeFromSuperview];
            }
        }
        else 
        {
            UIView *someView = [[UIView alloc] initWithFrame:someFrame];
    
            [thisCell.contentView addSubview:someView];
            [someView release];
    
            subviewAdded = YES;
        }
    
        NSMutableArray *array = [NSMutableArray array]; 
    
        [array addObject:indexPath];
    
        [tableView reloadRowsAtIndexPaths:array 
                         withRowAnimation:UITableViewRowAnimationFade];
    }
    

    So what’s going to happen here is you’re adding a subview to this cell you’ve tapped. Reloading this cell will call heightForRowAtIndexPath and do a nice little fade animation and change your tableview heights.

    IMPORTANT: Ideally, you should maintain an array of NSNumbers with boolean values. The array size should be the same size as the number of tableview cells you have.

    In heightForRow, you would then check against this array instead of using a single boolean for the whole tableView. This would ensure that you could have different heights for different cells.

    That would look something like:

    - (CGFloat)tableView:(UITableView *)tableView 
               heightForRowAtIndexPath:(NSIndexPath *)indexPath {
        BOOL thisBool = (BOOL)[[booleanArray objectAtIndex:indexPath.row] boolValue];
    
        return (thisBool?100.0f:50.0f);
    }
    

    I didn’t post all that code here since it’s implied and what I’ve posted should put you well on your way to doing the boolean array thing.

    Anyway, there you are. I just tested this code myself so it works 🙂

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

Sidebar

Related Questions

i trying to resize the height of a flash object to the size of
I am trying to resize an image based off of a max-width/max-height array. Here's
I'm trying to resize a HTML5 canvas element using jQuery. (NOTICE: Not the objects
I am trying to resize an image with the maximum of 1000px width but
I am trying to resize my drawing area to a smaller size but whenever
I'm trying to resize an image that is uploaded to Drupal via a form.
I'm trying to resize some images using PHP and Imagick, however when I do
I'm trying to resize a bunch of photos that have been previously uploaded via
I am trying to resize <td> elements using the jquery .width() method. By default
My problem is the next: I am trying resize a image size depending a

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.