gpt4 book ai didi

iphone - 在 UITableView 上显示重新排序控件时启用滑动删除

转载 作者:行者123 更新时间:2023-12-03 18:26:12 25 4
gpt4 key购买 nike

我希望允许对 UITableViewCell 进行重新排序,并通过滑动删除来删除,但不能通过红色删除圆圈进行删除。

- (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] 但没有成功。

Image
(来源:booleanmagic.com)

最佳答案

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

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

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

关于iphone - 在 UITableView 上显示重新排序控件时启用滑动删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1436153/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com