Try #3:
You can add an activity indicator as a new view on top of your table view... something like: http://tapadoo.com/2009/iphone-how-to-do-full-screen-activity-status - then the trick would be figuring out when it's actually finished. I guess in your heightForRowAtIndexPath: method you could keep some kind of row count and check if that count is >= your data model row count. Does that do the trick?
Try #2:
Try to comment out your overridden tableView:heightForRowAtIndexPath: method completely, and instead where you create your cells in cellForRowAtIndexPath: try something like this:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
CGRect contentRectTall = CGRectMake(0.0, 0.0, 302.0, 140.0);
CGRect contentRectMed = CGRectMake(0.0, 0.0, 302.0, 70.0);
CGRect contentRectSmall = CGRectMake(0.0, 0.0, 302.0, 42.0);
... cell dequeue etc ...
if ( ...the type of this cell is kRowTypeTall for example... ) {
cell = [[[UITableViewCell alloc] initWithFrame:contentRectTall reuseIdentifier:CellIdentifier] autorelease];
...
} else if ( ...the cell type is kRowTypeMed ) {
...
} else if ( ...the cell type is kRowTypeSmall ) {
...
}
... other cell customization ...
}
Other than that, you might want to look into "lazy loading" where you'd load say the first 50 cells, then add a "load 50 more" type of button at the end.
If you already know your row type (which is contained in some kind of data source) it should be pretty quick to pull out.
Something like...
enum {
kRowTypeHuge = 0,
kRowTypeMed,
kRowTypeSmall
};
-(id)init {
...
NSArray *tableRows = [[NSArray alloc] initWithObjects:
[NSNumber numberWithUnsignedInt: 0],
[NSNumber numberWithUnsignedInt: 1],
[NSNumber numberWithUnsignedInt: 0],
[NSNumber numberWithUnsignedInt: 0],
[NSNumber numberWithUnsignedInt: 2],
nil
];
self.rows = tableRows;
[tableRows release];
...
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger rowType = [[[self.rows] objectAtIndex: indexPath.row] unsignedIntValue];
if(rowType == kRowTypeHuge) {
return 105.0;
} else if(rowType == kRowTypeMed) {
return 44.0;
}
return 20.0;
}
To be positive that heightForRowAtIndexPath is the issue... does something like this render super fast?
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 52.0;
}