我需要UITableview
具体- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
的帮助。
在此我设置[tableView setEditing:YES animated:YES];
然后表包含delete和moveCell功能。但我只需要moveCell功能。我不想要删除类别。
像这样,
有没有办法做到这一点? 帮助者很感激。
答案 0 :(得分:2)
只需使用此方法,以便单元格没有编辑控件:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleNone;
}
为了不允许指定行的缩进背景:
- (BOOL)tableView:(UITableView *)tableview shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
这样行就可以移动了:
-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}