支持
- iOS 8+
看一下几个demo

demo列表

知乎日报

本地图片轮播

网络图片轮播

StoryBoard创建

不无限轮播

不显示pageControl
如何使用
var cycleScrollView:WRCycleScrollView?
let height = 520 * kScreenWidth / 1080.0
let frame = CGRect(x: 0, y: 150, width: kScreenWidth, height: height)
// 可加载网络图片或者本地图片
let serverImages = ["http://mobile/s252_05471521705899113.png",.......]
// 构造方法
cycleScrollView = WRCycleScrollView(frame: frame, type: .SERVER, imgs: serverImages)
view.addSubview(cycleScrollView!)
// 添加代理
cycleScrollView?.delegate = self
代理方法(点击事件 和 图片滚动事件)
extension ServerImgController: WRCycleScrollViewDelegate
{
/// 点击图片事件
func cycleScrollViewDidSelect(at index:Int, cycleScrollView:WRCycleScrollView)
{
print("点击了第\(index+1)个图片")
}
/// 图片滚动事件
func cycleScrollViewDidScroll(to index:Int, cycleScrollView:WRCycleScrollView)
{
print("滚动到了第\(index+1)个图片")
}
}
demo下载地址:WRCycleScrollView
强烈推荐:超简单!!! iOS设置状态栏、导航栏按钮、标题、颜色、透明度,偏移等
https://github.com/wangrui460/WRNavigationBar
https://github.com/wangrui460/WRNavigationBar_swift
欢迎关注我的微博:wangrui460