HKBanner
Swift自定义视图组件,支持远程图片和无限循环。
安装
CocoaPods支持的版本:
# for swift 4.2
pod 'HKBanner'
使用
var options = BannerOptions(bannerInsets: UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15),
pageInset: UIEdgeInsets(top: 0, left: 4, bottom: 0, right: 4),
isCyclic: true)
// optional, set if needs auto scrolling
options.autoScrollDelay = 3
// optional, set if needs page indicator
let pageIndicator = DashPageIndicator()
options.pageIndicator = pageIndicator
// create banner view with options
let banner = Banner(options: options)
view.addSubview(banner)
banner.snp.makeConstraints {
$0.top.equalToSuperview().inset(50)
$0.left.right.equalToSuperview()
$0.height.equalTo(200)
}
// set datasource
let imagePageVendor = ImagePageVendor(items: [
"http://www.xxx.com/xxx.jpg",
"http://www.xxx.com/xxx.jpg",
"http://www.xxx.com/xxx.jpg",
...
]) { (index) in
// handle tap action here
print("Taped at index: \(index)")
}
// display data
banner.reload(with: imagePageVendor)
阅读示例代码以了解详细信息!
许可证
MIT许可证
版权所有(c) 2019 Harley.xk
在此特此授予任何人免费使用本软件及其相关文档文件(统称为“软件”)的权利,不受任何限制地处理该软件,包括但不限于以下权利:
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
本软件按“现状”提供,不提供任何形式的质量保证,包括但不限于适销性、针对特定目的的适用性和非侵权的保证。在任何情况下,作者或版权所有者均不对因上述软件或其使用或其他方式产生的任何索赔、损害或责任(无论是否为合同、侵权或其他方式)承担任何责任。