要运行示例项目,首先克隆仓库,然后从 Example 目录中运行 pod install
。
JLCustomPagingView 可以通过 CocoaPods 获得。要安装它,只需将以下行添加到你的 Podfile 中
pod "JLCustomPagingView"
在每个使用此框架的文件中导入它。
import JLCustomPagingView
打开包含你想要创建 JLCustomPagingView
实例的视图控制器的 Storyboard,为视图控制器添加一个视图,放置你想要的全部约束,然后你需要说明该视图是一个 JLCustomPagingView
并创建一个指向此 JLCustomPagingView
的输出。
@IBOutlet weak var myPagingView: JLCustomPagingView!
创建相应的输出后,你应该实现接口 CustomPagingViewDataSource
和 CustomPagingViewDelegate
。
class ViewController: UIViewController,CustomPagingViewDataSource,CustomPagingViewDelegate
reloadData()
你想要拥有的项目数量
numbOfItems()->Int
应该保持在索引处的项目
itemAtIndex(index:Int)->UIView!
此方法被调用以了解对应索引处的项目是否应识别触摸事件
shouldItemReceiveTapEvents(ItemAtIndex index:Int)->Bool
当用户触摸顶部项时调用此方法
didSelectItemWithIndex(index:Int,item:UIView)
当顶部可见项(活动项)更改时调用此方法
didChangeTopItemIndexTo(newTopItemIndex:Int,lastTopItemIndex:Int)
José Lucas
JLCustomPagingView遵循MIT许可证。有关更多信息,请参阅LICENSE文件。