如何执行UITableViewCell的自定义移动?

时间:2012-06-26 15:59:34

标签: iphone uitableview uikit

我想像这两种方法一样移动单元格:

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath;
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;

在我使用上述方法移动单元格(通过用户的触摸操作)之前,必须先调用tableView的setEditing:animated:。

但我想要的是用户长按然后拖动一个单元格来移动它而不进入编辑样式,我希望这些移动视图不会出现在单元格中,如下所示:

enter image description here

有什么建议吗?特别的thx!

1 个答案:

答案 0 :(得分:1)

一个解决方案:http://b2cloud.com.au/how-to-guides/reordering-a-uitableviewcell-from-any-touch-point

但它无法使用长按手势来开始拖动

我们可以使用FMMoveTableView来执行此操作。