gpt4 book ai didi

ios - 无法对 UITableView 中的行重新排序

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:54:09 24 4
gpt4 key购买 nike

我在尝试对 UITableView 中的行重新排序时遇到了问题。我触发了函数 tableView:moveRowAtIndexPath:toIndexPath:,但是 fromIndexPath 等于 toIndexPath(即源 == 目标)。我在这里看到了同样的问题:uitableview re-order won't work, source always equal to destination但解决方案是 - 使用不同的库。这不是我的变体。

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
//fromIndexPath is equal to toIndexPath, so nothing is exchaned
[self.table_data exchangeObjectAtIndex:fromIndexPath.row withObjectAtIndex:toIndexPath.row];
}

我的表处于可编辑模式,我有 canMoveRowAtIndexPath: 返回 YES。我的它没有帮助。怎么会?我做错了什么?

最佳答案

问题出在自定义平移手势识别器中。它以某种方式与行拖放行为冲突

设置 myGestureRecognizer.cancelsTouchesInView = NO; 解决了这个问题

关于ios - 无法对 UITableView 中的行重新排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29578839/

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