HPReorderTableView 0.2

HPReorderTableView 0.2

测试已测试
Lang语言 Obj-CObjective C
许可证 Apache 2
发布最后发布2014年12月

Hermes Pique 维护。




Build Status

用于通过长按单元格任何部分来重新排序单元格的内置 UITableView 替代品。

Reordering animation

安装

使用 CocoaPods

pod 'HPReorderTableView', '~> 0.2'

或者如果您是手动操作的,将这些文件从 HPReorderTableView 目录添加。

使用

只需实例化 HPReorderTableView 而不是 UITableView

UITableView *tableView = [[HPReorderTableView alloc] init];

或者如果您在使用 Interface Builder,将表格视图的类更改为 HPReorderTableView

然后按照您在使用默认排序行为时通常所做的那样,实现您的表格视图数据源的重排序方法。例如

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{
    [_objects exchangeObjectAtIndex:sourceIndexPath.row withObjectAtIndex:destinationIndexPath.row];
}

自定义

请参阅有关自定义选项的文档

要求

HPReorderTableView 需要 iOS 6.1 或更高版本和 ARC。

许可证

版权 2014 Hermes Pique (@hpique)

遵循 Apache 许可证,版本 2.0(“许可证”);除非遵守许可证,否则不得使用此文件。您可以在以下位置获得许可证的副本:

https://apache.ac.cn/licenses/LICENSE-2.0

除非适用法律要求或书面同意,否则在此许可证下分发的软件按“原样”分发,不屈从于任何明示或暗示的保证或条件。有关权限和限制的具体语言,请参阅许可证。

使用了 BVReorderTableView 的代码,由 bvogelzang 提供。