UITableView:将一行拖到另一个上 [英] UITableView: Drag a row onto another one
问题描述
我设法找到一个解决方法:在首次点击自定义UITableCellView后,我创建一个新的UIView放在屏幕的另一个触摸+拖动的窗口顶部。
另一个触摸创建一个UIImageView,将不起眼的点击单元格复制为图像。这个UIImageView可以沿着UIView拖动,然后在必要的时候被关闭。
当我结束触摸时,如果它结束了另一个单元格,我会得到它的indexPath并计算一致的动作
I have a UITableView that represents a list of objects, I'd like the user to touch an object, drag it onto another one (as to combine them) and seeing the two disappearing and a new one appearing. I guess that I can't do this with the standard table view editing methods (a row cannot be dragged onto another one, am I right?). Shall I write my touch listeners? how can I do that?
I managed to find a workaround: after the first click on a custom UITableCellView I create a new UIView to put on top of the window that intercepts another touch+drag.
The other touch creates a UIImageView that copies the undelying clicked cell as a Image. This UIImageView can be dragged around along the UIView and then dismissed when necessary.
When I end the touch I look if it ended up a another cell, if so I get its indexPath and compute a coherent action
这篇关于UITableView:将一行拖到另一个上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!