我需要 UITableview
方面的帮助,特别是 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
。
在此如果我设置[tableView setEditing:YES animated:YES];
然后表包含删除和移动单元格功能。但我只需要 moveCell 功能。我不想要删除类别。
像这样,
有什么办法吗? 感谢帮助者。
最佳答案
只需使用此方法,单元格就没有编辑控件:
- (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;
}
关于ios - 没有删除按钮的 moveRowAtIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22763287/