Speed Problem - Animating Height Change in UITableView

Posted by Travis on Stack Overflow See other posts from Stack Overflow or by Travis
Published on 2010-04-07T21:22:02Z Indexed on 2010/04/07 21:53 UTC
Read the original article Hit count: 561

So I have a huge UITableView, between 1000 and 3000 rows. Each row needs to, when selected, expand to include several buttons. I do this by rendering the buttons below the cell, enabling clipping on the cells, and then just animating a change in height when they're selected. So I have heightForRowAtIndex checking if the row is selected, if so it gives a different height value. To do the animation, I have the following:

- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath
{
    [self.tableView beginUpdates];
    [self.tableView endUpdates];
}

This all works wonderfully until I get around 1000 rows, at which point the animations still work and are still quite smooth, but they lag by a second or two. My first thought was a memory problem, but everything is being autoreleased and upon inspection my application isn't even receiving a memory warning message.

So...any ideas on what this might be and how I can erase this lag between selection and change in cell height?

Oh, and one last thing - right now I'm testing this on the iPad, so if this is a problem there, I expect it to be worse on our other target devices (iPhone and iPod).

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch