There is no other mechanism for determining cell height than heightForRowAtIndexPath. If you do not properly account for the extended cell in this method, you will find that your other cells either run through it or hide under it. From the bone code where I forgot to set heightForRowAtIndexPath, I am sure that your other cells will be displayed above it.
Since you are talking about thousands of rows, we will assume that the user cannot reorder the cells.
What you can do is keep the extended index path of the cell when the user deletes the given cell. Then heightForRowAtIndexPath might look like this:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath
{
if ([indexPath isEqual:lastSelectedIndexPath])
{
return 80;
}
else {
return 44;
}
}
If you really need several options, you can save the corresponding index paths to an array and check them as follows:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath
{
CGFloat cellHeight = 44;
for (NSIndexPath *expandedIndexPath in expandedIndexPathsArray)
{
if ([indexPath compare:expandedIndexPath] == NSOrderedSame)
{
cellHeight = 80;
break;
}
}
return cellHeight;
}
, . UI . , , - , , .
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPathswithRowAnimation:(UITableViewRowAnimation)animation
, , .
, .
, , , . .