测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最新版本 | 2017年5月 |
由 Stan Chang Khin Boon 维护。
扩展了 UICollectionViewFlowLayout
以支持单元格重排,类似于 iBook 中的长按和拖动。
LXReorderableCollectionViewFlowLayout 的目标是提供类似 iBook 的单元格重排功能。
使用 CocoaPods 或将 LXReorderableCollectionViewFlowLayout
文件夹拖动到项目中安装。
初始化/设置您的收藏视图以使用 LXReorderableCollectionViewFlowLayout
。
要支持重排功能的收藏视图控制器必须遵循 LXReorderableCollectionViewDataSource
协议。例如,
- (void)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath willMoveToIndexPath:(NSIndexPath *)toIndexPath {
id object = [mutableArray objectAtIndex:fromIndexPath.item];
[mutableArray removeObjectAtIndex:fromIndexPath.item];
[mutableArray insertObject:object atIndex:toIndexPath.item];
}
您可以通过遵循 LXReorderableCollectionViewDelegateFlowLayout
方法来监听一些拖动事件。
根据您的需求设置您的收藏视图,运行并查看效果! :D
LXReorderableCollectionViewFlowLayout在MIT许可证下可用。