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

后端 未结 5 1739
轻奢々
轻奢々 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:18

    According to Apple's documentation, and my own experience, this is some simple code that works quite well:

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

提交回复
热议问题