测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最新版本 | 2016年12月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 hoggenw 维护。
要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install
命令。
YLBanner 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile。
pod "YLBanner"
let bannerScroller = YLBanner(frame: CGRect(x: 0, y: 0, width: MAIN_WIDTH, height:BannerHeight), 3)
//你的数据源
var array = [UIImageView]()
for model in dataArray[0] {
array.append(model.bannerImageView)
}
// 获取数据源
bannerScroller?.contentViewAtIndex = {(_ pageIndex: Int) in
if array.count > 0 {
return array[pageIndex]
}
return UIImageView()
}
//获取轮播张数,大于1启动轮播
bannerScroller?.setTotalPagesCount(totalPageCout: { () -> (Int) in
return array.count
})
//点击回调响应
bannerScroller?.tapActionBlock = {[weak self](index) in
if (self?.dataArray[0].count)! > 0 {
let model = self?.dataArray[0][index]
MobClick.event("Banner")
print("model?.url=\(model?.url)")
self?.dealModel(model: model!)
}
}
hoggenw
YLBanner 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。