UITableView:将单元格移动到另一个位置,并拖动&下降 [英] UITableView: move cell to a position to another with drag & drop

查看:221
本文介绍了UITableView:将单元格移动到另一个位置,并拖动&下降的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有3个部分的表格(第一部分,第二部分和第三部分)。我想实施一个机制,通过拖放来改变单元格的位置



示例1:
在第一部分中,我有两行(sec1_row1和sec1_row2)。在第二部分中,我有一行(sec2_row1)通过拖放drop功能我想用sec2_row1反转sec1_row2。我想选择sec2_row1,将其拖放到sec2_row1上,并将其拖放到相反的行。



我希望此功能也可用于同一部分的行。



实现此功能的最佳方式是什么?



提前感谢

解决方案

/ p>

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/ManageReorderRow/ManageReorderRow.html



你需要管理



targetIndexPathForMoveFromRowAtIndexPath



canMoveRowAtIndexPath


i have a table with 3 section (section one, section two and section three). I would like implement a mechanism to change a cell's position with drag & drop (inside same section or from a section to another).

Example 1: In section one i have two rows (sec1_row1 and sec1_row2). In section two i have one row (sec2_row1) by drag & drop function i would like invert the sec1_row2 with sec2_row1. I would like select the sec2_row1, drag it on sec2_row1 and drop it so the rows are inverted.

I would like that this feature will be also available for rows of same section.

What is the best way to implement this feature?

Thanks in advance.

解决方案

Check this apple doc link

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/ManageReorderRow/ManageReorderRow.html

you need to manage conditions in

targetIndexPathForMoveFromRowAtIndexPath

canMoveRowAtIndexPath

这篇关于UITableView:将单元格移动到另一个位置,并拖动&下降的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆