What methods do I have to implement in order to re-arrange the UITableView rows?

后端 未结 5 1637
轻奢々
轻奢々 2021-02-04 18:43

For a simple example of using a NSMutableArray of strings called rows, what do I have to implement in my table controller to move the tableView rows and have the changes reflect

5条回答
  •  遇见更好的自我
    2021-02-04 19:23

    Found this discussion after breaking my head against a simple implementation... Michael Berding solution is the best for me, the Apple way, just remember to remove retain and release when using ARC. So, a more concise solution

    NSObject *tempObj = [self.rows objectAtIndex:fromIndexPath.row];
    [self.rows removeObjectAtIndex:fromIndexPath.row];
    [self.rows insertObject:tempObj atIndex:toIndexPath.row];
    

提交回复
热议问题