0
如果self.objects数组是只读的,如何处理PFQueryTableView中单元格的重新排序?重新排序PFQueryTableView中的单元格?
我可以让表进入编辑模式,我甚至可以重新排列单元格,但我不知道如何处理委托方法中的更改。我试图从self.objects数组中创建一个NSMutableArray
,但我不知道要在解析中更新对象。这是我已经尝试过:
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
NSMutableArray *array = [[NSMutableArray alloc]initWithArray:self.objects];
PFObject *movedObject = array[fromIndexPath.row];
[array removeObjectAtIndex:fromIndexPath.row];
[array insertObject:movedObject atIndex:toIndexPath.row];
//Then trying to reassign the updated mutable array to the self.objects array is not possible because its read only.
}
任何帮助将不胜感激。
你可以与你分享你重新安排的对象,让他们保持这种方式?试图在PFQueryTableViewController的子类上执行此操作。谢谢! –