swift版的无限循环轮播图,可自定义时间间隔,设置本地、远端图片或混设,目前配合Kingfisher一起使用(url图片赋值ImageView和缓存)。
-
无限循环轮播
-
图片点击闭包
-
本地、远端图片混设
-
支持code、xib、storyboard调用
-
支持旋转
-
支持iPhone、iPad
下载后直接把GLLoopView文件夹(里面有CircleView.swift和CircleView.xib2个文件)拉进项目中。
(因有xib文件,支持cocoapods在storyboard和xib中使用时,会报编译错误,对运行无影响,所以暂缓支持cocoapods)
pod添加kingfisher(或者其它方法)
let imageArray: [GLImageModel] = [GLImageModel("first.jpg", type: .local), GLImageModel("second.jpg", type: .local), GLImageModel("third.jpg", type: .local)]
self.circleView.imageModelArray = imageArray
self.circleView.timeInterval = 5
self.circleView.clickCircleViewClosure = { currentIndex in
print(currentIndex, terminator: " ");
}
let imageArray: [GLImageModel] = [GLImageModel("first.jpg", type: .local), GLImageModel("second.jpg", type: .local), GLImageModel("third.jpg", type: .local)]
self.circleView = GLCircleView(frame: CGRect(x: 0, y: 64, width: self.view.frame.size.width, height: 200))
self.circleView.imageModelArray = imageArray
self.circleView.timeInterval = 5
self.circleView.clickCircleViewClosure = { currentIndex in
print(currentIndex, terminator: " ");
}
self.view.addSubview(circleView)
let urlImageModel = GLImageModel(self.circleView.imageModelArray.count % 2 == 0 ? url1 : url2, type: .url)
self.circleView.imageModelArray.append(urlImageModel)
-
支持pod
-
开放更多功能
如有意见,欢迎issue