【问题标题】:moveRowAtIndexPath without Delete buttonmoveRowAtIndexPath 没有删除按钮
【发布时间】:2014-03-31 13:47:46
【问题描述】:

我需要UITableview 的帮助,特别是- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath

如果我设置[tableView setEditing:YES animated:YES];,则表包含删除和移动单元功能。但我只需要 moveCell 功能。我不想要删除类别。

这样,

有没有办法做到这一点? 感谢帮助。

【问题讨论】:

标签: ios iphone objective-c uitableview


【解决方案1】:

只需使用此方法,使单元格没有编辑控件:

- (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;
 }

【讨论】:

    猜你喜欢
    • 2012-08-11
    • 1970-01-01
    • 1970-01-01
    • 2014-01-11
    • 1970-01-01
    • 2016-07-15
    • 2021-11-27
    • 2011-06-21
    • 1970-01-01
    相关资源
    最近更新 更多