テーブルビューに 2 つのセクションがあり、1 つのセクションのみを更新する可変配列があります。セルを配列のあるセクションから空白のセクションに移動したいと思います。空白のセクション自体に別の配列を作成しようとしましたが、機能させることができませんでした。これが私の moveRowAtIndexPath メソッドです。
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
id objectToMove = [myArray1 objectAtIndex:fromIndexPath.row];
id objectToMove2 = [myArray2 objectAtIndex:fromIndexPath.row];
//move objects between main section
[myArray1 removeObjectAtIndex:fromIndexPath.row];
[myArray1 insertObject:objectToMove atIndex:toIndexPath.row];
//move object from main section to blank section
[myArray1 removeObjectAtIndex:fromIndexPath.row];
[myArray2 insertObject:objectToMove atIndex:toIndexPath.row];
numberOfRowsInSection が各セクションの適切な配列カウントを返しますが、まだ運がありません。編集モードに入ってセルを移動しようとすると、セルが消えます。