Iphone UITableView中的重新排序控件

Iphone UITableView中的重新排序控件,iphone,uitableview,Iphone,Uitableview,我正在开发一个游戏,其中我使用了一个具有自定义单元格(UItableViewCell子类)的UITableView 在编辑模式下: 应仅显示UITableView的重新排序控件 现在我得到了delete和reordering控件 如何在编辑时仅获取重新排序控件? tableView.showsReorderControl = YES; // to show reordering control 要取消删除控件,请在UITableViewDelegate中添加 - (UITableViewCe

我正在开发一个游戏,其中我使用了一个具有自定义单元格(
UItableViewCell
子类)的
UITableView

在编辑模式下: 应仅显示
UITableView
的重新排序控件

现在我得到了delete和reordering控件

如何在编辑时仅获取重新排序控件?

 tableView.showsReorderControl = YES; // to show reordering control
要取消删除控件,请在UITableViewDelegate中添加

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return UITableViewCellEditingStyleNone;
}

非常感谢,它起作用了。。。。 我在写这封信

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

     static NSString *CellIdentifier = @"Cell";

     UITableViewCell *cell = [tableView1 dequeueReusableCellWithIdentifier:CellIdentifier];

     if (!cell) {
         cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
     }

     cell.showsReorderControl = YES; // to show reordering control

    return cell;
}
但我无法写出你给出的方法


非常感谢

我知道这个答案可能晚了,但我只是为了那些仍然需要它的人。 只需执行以下方法:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}
- (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;
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{

}

您应该使用此方法隐藏删除按钮

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleNone;
}
Swift 5.0 如果要禁用tableView单元格的所有其他编辑选项(允许重新排序的选项除外),则只需从UITableViewDelegate实现这些方法:

func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
    true
}

// Removes the ability to delete current cell
func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
    .none
}

func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
    true
}

仍然没有-我在一个UITableView中有两种UITableViewCell。打印数据工作顺利,但我无法显示重新排列控制:/