Swift仿选择电影票的效果并实现无限/自动轮播的方法

2020-01-09 09:09:49丽君
 

实现了什么功能?

1.类似于选择电影票的效果

2.自动轮播

3.无限轮播

4.非当前显示view具有缩放和透明的特效

5.页面滚动的方向分为横向和纵向

仿照UITableView使用代理实现传值


protocol PageFlowViewDelegate : NSObjectProtocol{
 func sizeForPageInFlowView(flowView : PageFlowView) -> CGSize
 /// 滚动到了某一列
 func didScrollToPage(pageNumber : Int,inFlowView flowView : PageFlowView)
 
 /// 点击了第几个cell
 ///
 /// - Parameters:
 /// - subView: 点击的控件
 /// - subIndex: 点击控件的index
 func didSelectCell(subView : IndexBannerSubiew,subViewIndex subIndex : Int)
}

protocol PageFlowViewDataSource : NSObjectProtocol{
 /// 返回显示View的个数
 func numberOfPagesInFlowView(flowView : PageFlowView) -> Int
 
 /// 给某一列设置属性
 ///
 /// - Parameters:
 /// - flowView: <#flowView description#>
 /// - index: <#index description#>
 /// - Returns: <#return value description#>
 func cellForPageAtIndex(flowView : PageFlowView,atIndex index : Int) -> IndexBannerSubiew
}