TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by hoggenw.
To run the example project, clone the repo, and run pod install
from the Example directory first.
YLBanner is available through CocoaPods. To install it, simply add the following line to your 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 is available under the MIT license. See the LICENSE file for more info.