テーブル ビュー セルが削除されたときにアニメーションを表示するのに問題があります。アニメーションを表示する唯一のセルは一番下のセルです。テーブル ビューの行数の大小に関係なく、常に一番下のセルです。それが違いを生む場合、グループ化されたテーブルビューセルがあります。[tableView beginUpdates
&[tableView endUpdates
ブロックや、オンラインで見つけたこのコードを使用するなど、複数のことを試しました。
[UIView beginAnimations:@"myAnimationId" context:nil];
[UIView setAnimationDuration:10.0]; // Set duration here
[CATransaction begin];
[CATransaction setCompletionBlock:^{
NSLog(@"Complete!");
}];
[myTable beginUpdates];
// my table changes
[myTable endUpdates];
[CATransaction commit];
[UIView commitAnimations];
これは私が現在持っているものです:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
NSLog(@"Recent: %@", self.recentSearchesArray[indexPath.row][0]);
NSMutableArray *tempMutableArray = [[NSMutableArray alloc] initWithArray:self.recentSearchesArray];
[tempMutableArray removeObjectAtIndex:indexPath.row];
self.recentSearchesArray = tempMutableArray;
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
self.recentSearchesArray = tempMutableArray;
}
[self.tableView reloadData];
}
私が間違っていること、またはこれを修正する方法を知っている人はいますか? ヘルプとガイダンスに感謝します。前もって感謝します。