13

我希望允许重新排序UITableViewCells 并通过滑动删除,但不能通过红色删除圈。

- (void)loadView
{
    [super loadView];
    [table setEditing:YES animated:NO];
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Perform delete here
    }
}

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
    // Perform move here
}

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

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

此外,我尝试禁用编辑模式并-[UITableViewCell setShowsReorderControl:YES]没有运气调用。

图片
(来源:booleanmagic.com

4

1 回答 1

2

我认为您必须进行一些自定义触摸事件拦截。

英文:如果手指移动,x 距离,水平跨单元格,仅在该单元格中,然后显示删除控件。

不知道如何关闭左侧的圆圈,但我确实认为这是一个类似于“显示重新排序控制”的属性

于 2009-10-21T21:57:33.137 回答