博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[翻译] HTKDragAndDropCollectionViewLayout
阅读量:6974 次
发布时间:2019-06-27

本文共 1672 字,大约阅读时间需要 5 分钟。

HTKDragAndDropCollectionViewLayout

Custom UICollectionViewLayout that works together with a custom UICollectionViewCell to provide drag and drop for a UICollectionView. Works just like UITableView drag and drop. What's unique about this approach is that it does not need to create a "ghost" or "dummy" cell to provide the drag and drop functionality. I believe this method is simpler and less complex for the majority of use cases.

自定义UICollectionViewLayout,与UICollectionViewCell一起使用,提供拖拽功能。就像UITableView的拖拽功能一样。有点特别的地方就是你不需要创建出替代的cell来满足供你拖拽的动能。我相信,这个方法会简化你所写的代码。

 

Adding to your project: 添加到你的工程当中

Cocoapods

 is the recommended way to add HTKDragAndDropCollectionViewLayout to your project.

建议你用来导入到你的工程当中。

  1. Add a pod entry for HTKDragAndDropCollectionViewLayout to your Podfile pod 'HTKDragAndDropCollectionViewLayout', '~> 0.0.1' 添加'HTKDragAndDropCollectionViewLayout', '~> 0.0.1'到pod中
  2. Install the pod(s) by running pod install. 执行安装
  3. Subclass HTKDragAndDropCollectionViewController. 创建出HTKDragAndDropCollectionViewController子类
  4. Setup HTKDragAndDropCollectionViewLayout properties (itemSize, lineSpacing, etc). 设置HTKDragAndDropCollectionViewLayout属性
  5. Subclass and use HTKDraggableCollectionViewCell which implements the gestures for dragging. 创建出HTKDraggableCollectionViewCell子类然后实现手势与拖拽
  6. Implement - (void)userDidEndDraggingCell:(UICollectionViewCell *)cell and if theHTKDragAndDropCollectionViewLayout finalIndexPath is not nil, insert the draggedIndexPath into the finalIndexPath's position. See example in project. 实现方法- (void)userDidEndDraggingCell:(UICollectionViewCell *)cell,如果theHTKDragAndDropCollectionViewLayout最后的indexPath为nil,将draggedIndexPath插入到最后的位置上。请看demo工程。

 

转载地址:http://hdesl.baihongyu.com/

你可能感兴趣的文章
翻译webpack3.5.5 - code splitting - 上半部分
查看>>
列表用法
查看>>
Vue SPA 项目在 Amazon S3 部署小技巧
查看>>
数据段、数据报、数据包、帧的区别与联系
查看>>
如何迅速分析出系统CPU的瓶颈在哪里?
查看>>
Oracle推出轻量级Java微服务框架Helidon
查看>>
腾讯云小微激活硬件生态,携合作产品正式亮相
查看>>
记TensorFlow项目开源一周年
查看>>
「镁客·请讲」1058VR钱朱平:VR泛娱乐的时代未到,不妨从更细分的行业切入
查看>>
刷新本地的DNS缓存数据
查看>>
AI、量子计算引爆硬科技创新,雷鸣、王海峰、施尧耘等北大120周年论道信科最前沿...
查看>>
为什么物联网和区块链彼此依赖?
查看>>
安卓Textview的getLineCount返回0
查看>>
Windows 2008 R2 Administrator access denied解决办法
查看>>
Faker:Python的伪造数据生成器
查看>>
(桌面虚拟化最佳实践--呼叫中心系统优化之四)瘦终端优化项目与其他优化项目...
查看>>
自学社交的人工智能,会不会有一天取人类而代之?
查看>>
centos 6.5下安装fpm打包工具
查看>>
微信的视频如何找到文件并发送到电脑
查看>>
ionic react-native和native开发移动app到底那个好
查看>>