在UITableView中重新排序控件 [英] reordering control in UITableView

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

问题描述

我正在开发一款游戏,其中我使用的是 UITableView ,其中包含自定义单元格( UItableViewCell 子类)。

I am developing a game in which I am using a UITableView which has custom cell (UItableViewCell subclass).

在编辑模式下:
只有 UITableView的重新排序控件应该显示。

现在我正在获取删除和重新排序控件。

Right now I am getting the delete and the reordering control.

如何在编辑时只获得重新排序控制?

推荐答案

我知道这个答案可能会迟到,但我是把它放了仅适用于仍需要它的人。
只需实现以下方法:

I know this answer might be late, but I'm putting it just for people who still need it. Just implement the following methods:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleNone;
}
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
    return NO;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{

}

这篇关于在UITableView中重新排序控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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