项目介绍:
SGPagingView
效果图
主要内容的介绍
-
多种指示器长度样式
-
多种指示器滚动样式
-
标题按钮文字渐显效果
-
标题按钮文字缩放效果
SGPagingView 集成
-
1、CocoaPods 导入 pod ‘SGPagingView’, ‘~> 1.2.3’
-
2、下载、拖拽 “SGPagingView” 文件夹到工程中
代码介绍(详细使用, 请参考 Demo)
-
SGPagingView 的使用(在父视图的 viewDidLoad 中加入下面代码)
/// 子控制器及 pageContentView 的创建
ChildVCOne *oneVC = [[ChildVCOne alloc] init];
ChildVCTwo *twoVC = [[ChildVCTwo alloc] init];
ChildVCThree *threeVC = [[ChildVCThree alloc] init];
ChildVCFour *fourVC = [[ChildVCFour alloc] init];
/// 子控制器数组
NSArray *childVCArr = @[oneVC, twoVC, threeVC, fourVC];
CGFloat contentViewHeight = self.view.frame.size.height - 108;
self.pageContentView = [[SGPageContentView alloc] initWithFrame:CGRectMake(0, 108, self.view.frame.size.width, contentViewHeight) parentVC:self childVCs:childVCArr];
_pageContentView.delegatePageContentView = self;
[self.view addSubview:_pageContentView];
/// 子标题及 pageTitleView 的创建
NSArray *titleArr = @[@"精选", @"电影", @"电视剧", @"综艺"];
self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, 64, self.view.frame.size.width, 44) delegate:self titleNames:titleArr];
[self.view addSubview:_pageTitleView];
-
-
滚动内容视图的代理方法
-
- (void)pageContentView:(SGPageContentView *)pageContentView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex {
[self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex];
}
-
-
滚动标题视图的代理方法
-
- (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex {
[self.pageContentView setPageCententViewCurrentIndex:selectedIndex];
}