KSYCollectionViewLayout 1.2

KSYCollectionViewLayout 1.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2017年8月
SwiftSwift 版本3.0
SPM支持 SPM

‘huangdaxia’ 维护。



  • huangdaxia

KSYCollectionViewLayout

🚀瀑布流式的集合视图布局。

结果预览

demo preview

如何使用

  • init
  let layout = KSYCollectionViewLayout()
  layout.delegate = self
  • 集合视图使用布局
  let collect = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
  • 实现 KSYCollectionViewLayoutDelegate
extension ViewController: KSYCollectionViewLayoutDelegate {
    func numberOfColumn(in collectionView: UICollectionView) -> Int {
        return columnCount
    }
    
    func collectionView(_ collectionView: UICollectionView, layout: KSYCollectionViewLayout, heightForItemAt indexPath: IndexPath) -> CGFloat {
        let height = 200 + arc4random() % 100
        
        return CGFloat(height)
    }
}