我有一个表格视图,可以通过按编辑并将单元格拖动到新的位置来重新排列。我遇到的问题是应用程序关闭或者您转到其他视图控制器,然后返回到表格视图时,单元格已恢复到原始位置。这里是我的代码,以便重新排列:如何保存重新排列的表格视图位置
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
[arrayData removeObjectAtIndex:fromIndexPath.row];
[arrayData removeObjectAtIndex:toIndexPath.row];
}
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the item to be re-orderable.
return YES;
}
退房这个答案的正确引导。 http://stackoverflow.com/questions/17593068/getting-the-order-of-reordered-uitableviewcells – 2014-08-28 17:49:47