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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:10:04+00:00 2026-05-31T16:10:04+00:00

I have a bare-bones sample project here: http://dl.dropbox.com/u/7834263/ExpandingCells.zip In this project, a UITableView has

  • 0

I have a bare-bones sample project here:

http://dl.dropbox.com/u/7834263/ExpandingCells.zip

In this project, a UITableView has a custom UITableViewCell. In each cell are 3 UIViews containing a label.

The goal is to expand the cell when tapped, then collapse it when tapped again. The cell itself must change it’s height to expose the subviews. Inserting or removing rows is unacceptable.

The demo project works almost as expected. In fact, in iOS 4.3 it works perfect. Under iOS 5, however, when the rows collapse, the previous cells magically disappear.

To re-create the problem, run the project in the simulator or device with iOS 5 and tap the first cell to expand it. Then tap the cell again to collapse it. Finally, tap the cell directly underneath it. The previous one disappears.

Continuing the tapping for each cell in the section will cause all the cells to disappear, to where the entire section is missing.

I’ve also tried using reloadData instead of the current setup, but that ruins the animations and feels a bit like a hack anyway. reloadRowsAtIndexPaths should work, but the question is why doesn’t it?

See images of what’s happening below:

Table appears:

table appears

Cell expands:

table expands

Cell collapses:

table collapses

Cell disappears (when tapping the cell underneath):

cell disappears

Keep repeating until the entire section disappears:

section disappears

EDIT:
Overriding the alpha is a hack, but works. Here is another ‘hack’ that fixes it as well but WHY does it fix it?

JVViewController.m line 125:

if( previousIndexPath_ != nil )
{
    if( [previousIndexPath_ compare:indexPath] == NSOrderedSame ) currentCellSameAsPreviousCell = YES;

    JVCell *previousCell = (JVCell*)[self cellForIndexPath:previousIndexPath_];

    BOOL expanded = [previousCell expanded];
    if( expanded )
    {
        [previousCell setExpanded:NO];
        [indicesToReload addObject:[previousIndexPath_ copy]];
    }
    else if( currentCellSameAsPreviousCell )
    {
        [previousCell setExpanded:YES];
        [indicesToReload addObject:[previousIndexPath_ copy]];
    }

    //[indicesToReload addObject:[previousIndexPath_ copy]];
}

EDIT 2:

Made a few minor changes to demo project, worth checking out and reviewing JVViewController didSelectRowAtIndexPath method.

  • 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-31T16:10:05+00:00Added an answer on May 31, 2026 at 4:10 pm

    Your problem is in setExpanded: in JVCell.m, you are directly editing the frame of the target cell in that method.

    - (void)setExpanded:(BOOL)expanded
    {
        expanded_ = expanded;
    
        CGFloat newHeight = heightCollapsed_;
        if( expanded_ ) newHeight = heightExpanded_;
    
        CGRect frame = self.frame;
        frame.size.height = newHeight;
        self.frame = frame;
    }
    

    Update it to:

    - (void)setExpanded:(BOOL)expanded
    {
        expanded_ = expanded;
    }
    

    Then remove the call to -reloadRowsAtIndexPaths:withRowAnimation: at line 163 of JVViewController.m and it will animate as expected.

    -reloadRowsAtIndexPaths:withRowAnimation: expects different cells to be returned for the provided indexPaths. Since you are only adjusting sizes -beginUpdates & -endUpdates is sufficient to layout the table view cells again.

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

Sidebar

Related Questions

Suppose I have a garden-variety closure like this bare-bones sample: (let ((alpha 0) #|
EDIT The bare-bones version of this question is, if I have some object o
I was following the steps here: http://matt.might.net/articles/how-to-native-iphone-ipad-apps-in-javascript/ Here are the bare bones steps to
I have been trying to write a bare-bones ping scanner using Perl for internal
I have a bare bones ORM implementation, consisting of data mappers which load and
broken to bare-bones scene: I have a program in c# that calls a .exe
See code below. I've tried to strip it to its bare bones. I have
I have the bare bones of a GLUT app. When I compile it for
I am working on learning Windows Forms with C# and have a bare bones
I'm trying to get the registration flow for Facebook login working. Here's a bare-bones

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.