| 测试已测试 | ✗ |
| 语言语言 | SwiftSwift |
| 许可证 | MIT |
| 发布上次发布 | 2017年3月 |
| SwiftSwift 版本 | 3.0 |
| SPM支持 SPM | ✗ |
由 Ryo Ishikawa 维护。
在 ViewController 中使用的示例。
let layout = FlexibleCollectionViewLayout()
// The number of rows
layout.rows = 4
// The space between items
layout.spacing = 15
// Animation duration
layout.duration = 0.4
layout.sectionInset = UIEdgeInsets(top: 15, left: 15, bottom: 15, right: 15)
collectionView = FlexibleCollectionView(frame: UIScreen.main.bounds, layout: layout)
collectionView.delegate = self
collectionView.dataSource = self
collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "CELL")
view.addSubview(collectionView)
FlexibleCollectionViewLayout 继承自 UICollectionViewFlowLayout,以下属性可用。
| 属性名称 | 描述 |
|---|---|
| rows | 行数 |
| maximumRows | 最大行数 |
| minimumRows | 最小行数 |
| spacing | 项目之间的空间 |
| duration | 动画时长 |
| animationEnabled | 动画标志 |
FlexibleCollectionView 可以使用以下 delegate。
@objc public protocol FlexibleCollectionViewDelegate: UICollectionViewDelegate {
@objc optional func flexibleCollectionView(_ collectionView: FlexibleCollectionView, willSwipeViewFor direction: UISwipeGestureRecognizerDirection)
@objc optional func flexibleCollectionView(_ collectionView: FlexibleCollectionView, didSwipeViewFor direction: UISwipeGestureRecognizerDirection)
@objc optional func flexibleCollectionView(_ collectionView: FlexibleCollectionView, didFinishAnimation: Bool)
}
XCode8+
Swift3
pod "FlexibleCollectionView"并
$ pod install
Ryo Ishikawa,[email protected]
FlexibleCollectionView 可以在 MIT 许可证下使用。更多信息请参阅 LICENSE 文件。