SGPageView
建议去 GitHub 下载最新 Demo:https://github.com/kingsic/SGPageView.git
SGPageView 可根据内容自动选取是静止状态,还是滚动状态
使用方法:
* 将项目中 SGPageView 文件夹拖入工程
* 导入 #import "SGPageView.h" 的头文件
创建滚动内容视图
/// 创建子控制器
ChildVCOne *oneVC = [[ChildVCOne alloc] init];
ChildVCTwo *twoVC = [[ChildVCTwo alloc] init];
ChildVCThree *threeVC = [[ChildVCThree alloc] init];
ChildVCFour *fourVC = [[ChildVCFour alloc] init];
NSArray *childArr = @[oneVC, twoVC, threeVC, fourVC];
/// pageContentView
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:childArr];
_pageContentView.delegatePageContentView = self;
[self.view addSubview:_pageContentView];
滚动内容视图代理方法
- (void)SGPageContentView:(SGPageContentView *)SGPageContentView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex {
[self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex];
}
创建滚动标题视图
/// 子标题数组
NSArray *titleArr = @[@"精选", @"电影", @"电视剧", @"综艺"];
/// pageTitleView
self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, 64, self.view.frame.size.width, 44) delegate:self titleNames:titleArr];
_pageTitleView.selectedIndex = 1;
[self.view addSubview:_pageTitleView];
滚动标题视图代理方法
- (void)SGPageTitleView:(SGPageTitleView *)SGPageTitleView selectedIndex:(NSInteger)selectedIndex {
[self.pageContentView setPageCententViewCurrentIndex:selectedIndex];
}
下载地址:http://www.wenjiangs.com/wp-content/uploads/2021/docimg35/1934cae3379d6ad416867e902e367843.zip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论