we're not talking thousands of rows or anything, although if there was a way to make things scale up that high, I'd love it.
I have a table with 27 sections and 180 rows spread across all sections, and the scenario I'm currently getting stuck in is when I animate things to a model state with only 3 sections and 5 rows, and (even worse) back again.
I'm batching all the animations with beginUpdates/endUpdates. My app pretty well locks up for 1-2 seconds on an iphone4 while it figures things out, then the animations start.
I've tried both animating the removal/addition of each row, keeping the sections around (and dropping their row counts to 0 in the removal case), and also animating just the removal/insertions of the sections themselves (when the row count would have dropped to 0). I would have assumed the latter would give better performance but it didn't change things at all.
Is there anything that can be done on the app end to speed this up? Right now I have a rather gross bit of code to bail out of the individual animations if there are more than 20 of them, opting to just reloadData instead.
edit here's code that exhibits the problem. The performance of this code is slightly better than the equivalent monotouch code (which is what I was using before), but it's still pretty bad.
#import "TableViewController.h"
@interface MyTableViewDataSource : NSObject<UITableViewDataSource> {
int rows;
};
@end
@implementation MyTableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (void)setRowCount:(int)r
{
rows = r;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return rows;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusa