A picture/text infinite-scroll library with UICollectionView, It can be very easy to help you make the banner you want
使用UICollectionView
实现常见图片/文字无限轮播,支持自定义pageControl
,自定义文字样式,以及轮播样式
let cycleView = ZCycleView(frame: frame)
cycleView.placeholderImage = UIImage(named: "placeholder")
cycleView.setUrlsGroup(["http://...", "http://...", "http://..."])
cycleView.delegate = self
view.addSubview(cycleView)
你可以选择自己喜欢的图片加载库进行显示图片,例如Kingfisher或者SDWebImage
func cycleViewConfigureDefaultCellImageUrl(_ cycleView: ZCycleView, imageView: UIImageView, imageUrl: String?, index: Int) {
imageView.sd_setImage(with: URL(string: imageUrl!), placeholderImage: cycleView.placeholderImage)
}
func cycleViewConfigureDefaultCellImage(_ cycleView: ZCycleView, imageView: UIImageView, image: UIImage?, index: Int) {
imageView.image = image
}
func cycleViewConfigureDefaultCellText(_ cycleView: ZCycleView, titleLabel: UILabel, index: Int) {
titleLabel.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.6)
titleLabel.textColor = .white
titleLabel.font = UIFont.systemFont(ofSize: 13)
}
func cycleViewConfigurePageControl(_ cycleView: ZCycleView, pageControl: ZPageControl) {
pageControl.pageIndicatorTintColor = UIColor.green
pageControl.currentPageIndicatorTintColor = UIColor.red
}
@objc optional func cycleViewCustomCellIdentifier() -> String
@objc optional func cycleViewCustomCellClass() -> AnyClass
@objc optional func cycleViewCustomCellClassNib() -> UINib
@objc optional func cycleViewCustomCellSetup(_ cycleView: ZCycleView, cell: UICollectionViewCell, for index: Int)
- 邮箱: mqz1228@163.com
ZCycleView is released under the MIT license. See LICENSE for details.