SGPagingView-Swift
Objective-C 版本
iOS 技术交流群:429899752
结构图
SGPageTitleViewConfigure(SGPageTitleView 初始化配置信息)
SGPageTitleView(用于与 SGPageContent 联动)
SGPageContentScrollView(内部由 UIScrollView 实现)
SGPageContentCollectionView(内部由 UICollectionView 实现)
效果图
安装
- 1、使用 CocoaPods 导入 pod 'SGPagingViewSwift', '~> 0.0.1'
- 2、下载并将“SGPagingViewSwift”文件夹拖拽到工程中
代码说明(详细使用,请参考 Demo)
SGPagingView 的使用(详细使用,请参考 Demo)
// SGPageTitleViewConfigure
let configure = SGPageTitleViewConfigure()
// SGPageTitleView
self.pageTitleView = SGPageTitleView(frame: rect, delegate: self, titleNames: titles, configure: configure)
view.addSubview(pageTitleView!)
// SGPageContentScrollView
self.pageContentScrollView = SGPageContentScrollView(frame: contentRect, parentVC: self, childVCs: childVCs)
pageContentScrollView?.delegateScrollView = self
view.addSubview(pageContentScrollView!)
SGPageTitleView 代理方法
func pageTitleView(pageTitleView: SGPageTitleView, index: Int) {
pageContentScrollView?.setPageContentScrollView(index: index)
}
SGPageContentScrollView 代理方法
func pageContentScrollView(pageContentScrollView: SGPageContentScrollView, progress: CGFloat, originalIndex: Int, targetIndex: Int) {
pageTitleView?.setPageTitleView(progress: progress, originalIndex: originalIndex, targetIndex: targetIndex)
}
需求
- iOS 8.0 +
- Xcode 9.4.1+
结语
-
更多信息请参考 OC版本