我有一個正在與核心數據的用戶o增加自己的細胞一個UITableView ...但我希望他們能夠重新排序TableViewCells他們想要的方式...我使用現在的代碼,但每當重排出來,說我去添加其他細胞,它會返回下面,如果你失去了常規狀態...圖片...與核心數據的TableView重新排序UITableViewCells
下面是代碼:
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0) // Don't move the first row
return NO;
return YES;
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{
id ob = [_devices objectAtIndex:destinationIndexPath.row];
[_devices replaceObjectAtIndex:destinationIndexPath.row withObject:[_devices objectAtIndex:sourceIndexPath.row]];
[_devices replaceObjectAtIndex:sourceIndexPath.row withObject:ob];
}
那麼這怎麼做呢? PS,這是在該.m文件 – 2013-04-24 22:19:19
@property(強)的NSMutableArray *的設備的頂部; – 2013-04-24 22:19:59
已更新的答案,希望對您有所幫助。 – 2013-04-24 22:30:31