bestDew /
ZKCycleScrollViewDemo-OC
A simple and useful automatic infinite scroll view, more elegant implementation and more friendly API. Support Objective-C and Swift. 一款简单实用的轮播图控件,更优雅的实现,更友好的API。支持 Objective-C 和 Swift。
35/100 healthLoading repository data…
bestDew / repository
A simple and useful automatic infinite scroll view, more elegant implementation and more friendly API. Support Objective-C and Swift. 一款简单实用的轮播图控件,更优雅的实现,更友好的API。支持 Objective-C 和 Swift。
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
ZKCycleScrollView是的一个功能强大的轮播视图。支持 Objective-C 和 Swift。
pod install才能运行。pod 'ZKCycleScrollView-Swift'
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let cycleScrollView = ZKCycleScrollView(frame: CGRect(x: 0.0, y: 0.0, width: 375.0, height: 65.0))
cycleScrollView.delegate = self
cycleScrollView.dataSource = self
cycleScrollView.register(CustomCell.self, forCellWithReuseIdentifier: "cellReuseId")
view.addSubview(cycleScrollView)
}
}
extension ViewController: ZKCycleScrollViewDataSource {
func numberOfItems(in cycleScrollView: ZKCycleScrollView) -> Int {
return 5
}
func cycleScrollView(_ cycleScrollView: ZKCycleScrollView, cellForItemAt index: Int) -> ZKCycleScrollViewCell {
let cell = cycleScrollView.dequeueReusableCell(withReuseIdentifier: "cellReuseId", for: index) as! CustomCell
// TODO:
return cell
}
}
extension ViewController: ZKCycleScrollViewDelegate {
func cycleScrollView(_ cycleScrollView: ZKCycleScrollView, didSelectItemAt index: Int) {
// TODO:
}
}
1.支持 CocoaPods 导入:
pod 'ZKCycleScrollView-Swift'
2.支持取消无限轮播:
// 通过Xib 方式创建的,可直接在属性面板中直接设置 infiniteLoop 为 off
// 通过纯代码方式创建的,需要设置 infiniteLoop 参数为 false
public init(frame: CGRect, shouldInfiniteLoop infiniteLoop: Bool? = nil)
3.支持设置默认显示页:
// 设置默认从第三页开始显示
ccleScrollView.loadCompletion = { [weak self] in
guard let strongSelf = self else { return }
strongSelf.cycleScrollView.scrollToItem(at: 3, animated: false)
}
4.修复界面跳转时 cell 自动偏移的 bug;
5.修复在加载时就回调代理方法的 bug;
6.移除 -adjustWhenViewWillAppear 方法;
7.新增 -beginUpdates、-endUpdates、-scrollToIndex:animated:、-cellForItemAtIndex: 等方法,具体使用见Demo;
8.优化性能。
Selected from shared topics, language and repository description—not editorial ratings.
bestDew /
A simple and useful automatic infinite scroll view, more elegant implementation and more friendly API. Support Objective-C and Swift. 一款简单实用的轮播图控件,更优雅的实现,更友好的API。支持 Objective-C 和 Swift。
35/100 health