CollectionPageboy
描述
CollectionPageboy 是一个支持自定义您的 xib 的 cell,并且支持垂直或水平滚动的集合视图控制器。
安装
CocoaPods
pod 'CollectionPageboy'
使用方法
// in some controller:
let boy = CollectionPageboy<String>()
boy.items = ["a", "b","c", "d","e", "f","g", "h"]
boy.collectionHeight = 290
boy.collectionBGColor = .blue
boy.customCollectionCellNibName = "MyCustomCell"
boy.cellIdentifier = "MyCustomCell"
boy.style = .vertical
boy.rowCount = 4
boy.columnCount = 4
boy.present(based: self)
// then customize your collection view cell with xib
class MyCustomCell: PageboyCustomCollectionCell {
@IBOutlet weak var label: UILabel!
@IBOutlet weak var imageView: UIImageView!
override open func setup(_ item: Any) {
backgroundColor = UIColor.red.withAlphaComponent(0.15)
if let str = item as? String {
label.text = str
}
}
}
// more usages please download to see the sources demo.
需求
- iOS 9.0+
- Swift 4.2 至 5.1
作者
访问我的github: janlionly
通过邮箱联系我: [email protected]
贡献
我非常希望您为 CollectionPageboy 贡献
许可
CollectionPageboy 按照MIT许可证提供。有关更多信息,请参阅LICENSE文件。