ContinuesTouchCollectionView
用于处理单元格上的多个连续触摸的集合视图子视图。
演示
安装
pod 'ContinuesTouchCollectionView'要求
- Swift 4.2+
- iOS 9.0+
用法
- 创建一个
ContinuesTouchCollectionView实例并在其上填充ContinuesTouchCollectionViewCell - 你可以通过将
isLocked属性设置为 true 来禁用集合视图的滚动并启用多个连续触摸。 - 当你在填充单元格时,将单元格的
ContinuesTouchCollectionViewCellDelegate设置为你在工作的视图控制器。 - 使用代理方法了解当您的单元格开始或停止被触摸时的信息。
public protocol ContinuesTouchCollectionViewCellDelegate: class {
func continuesTouchCollectionViewCellDidStartTouching(_ cell: ContinuesTouchCollectionViewCell)
func continuesTouchCollectionViewCellDidStopTouching(_ cell: ContinuesTouchCollectionViewCell)
}- 您还可以在您的单元格类中覆盖
isTouching属性,以便使其响应高亮颜色。 - 使用
isTouching而不是isHighlight属性。
override var isTouching: Bool {
didSet {
backgroundColor = isTouching ? .lightGray : .darkGray
}
}- 查看示例项目以获得实现方法。
AppStore
此库在我应用 ScaleBud(iOS,AUv3)中用于AppStore,欢迎查看!
