PageLayout
这是一个简单的分页视图实现,它使用 Apple 的 UICollectionView
来处理回收和所有用户交互。
安装
CocoaPods 将 pod 'PageLayout'
添加到您的 Podfile
中并运行 pod install
手动安装 您始终可以直接将 PageLayout 文件插入到您的项目中。
使用此视图
要使用此视图,只需创建并插入一个 UICollectionView
实例到您的布局中,并在管理视图控制器内部,在 viewDidLoad
方法中调用 self.collectionView.configurePageView()
。这将使 collectionView
更新其布局管理对象为 PageLayout 实例,使其成为一个分页视图。
自定义
以下是您可以访问和自定义集合中 pageLayout
属性的属性列表
orientation: NSLayoutConstraint.Axis = .horizontal
sidePadding: CGFloat! = nil // nil causes this to be 15% of the collection view's width/height
itemSpacing: CGFloat! = nil // nil causes this to be equal to sidePadding
itemsToFit: Int! = nil // nil causes this to be 1