在不处于编辑模式时重新排序tableView中的行 [英] Reordering rows in tableView while not in editing mode

查看:106
本文介绍了在不处于编辑模式时重新排序tableView中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我实现了重新排序行的选项,但我使用默认编辑按钮显示删除按钮和三行图标来移动行。
但是我看过一个允许用户直接移动行的iOS应用程序,无需进入编辑模式。
我将不胜感激任何建议实现这种方式,以允许直接重新排序行,而不是使用编辑模式。
谢谢。

In my app I have implemented the option to re-order rows, but I am using the default edit button to show the delete button and the three lines icon to move the row. But I have seen an iOS app that allows the user to move rows directly, without need to enter the edit mode. I would appreciate any advice to implement that way to allow re-ordering rows directly, not using the edit mode. Thank you.

推荐答案

你需要实现这两个

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

并让你的表视图编辑设置为 YES ,以便显示重新排序控件。

and have your table view editing set to YES in order for the reorder controls to show.

这篇关于在不处于编辑模式时重新排序tableView中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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