You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

89 lines
2.9 KiB

//
// TFComicDetailFooterView.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/19.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFComicDetailFooterView.h"
#import "TFComicDetailLeftViewController.h"
#import "TFComicDetailRightViewController.h"
@interface TFComicDetailFooterView () <SGPageTitleViewDelegate, SGPageContentCollectionViewDelegate>
{
TFComicDetailLeftViewController *leftVC;
TFComicDetailRightViewController *rightVC;
}
@property (nonatomic, strong) SGPageTitleView *pageTitleView;
@property (nonatomic, strong) SGPageContentCollectionView *pageContentCollectionView;
@end
@implementation TFComicDetailFooterView
- (void)viewDidLoad
{
[super viewDidLoad];
[self hiddenNavigationBar:YES];
[self createSubViews];
}
- (void)createSubViews
{
WS(weakSelf)
leftVC = [[TFComicDetailLeftViewController alloc] init];
leftVC.pushToComicDetailBlock = ^(NSInteger production_id) {
if (weakSelf.pushToComicDetailBlock) {
weakSelf.pushToComicDetailBlock(production_id);
}
};
rightVC = [[TFComicDetailRightViewController alloc] init];
NSArray *childArr = @[leftVC, rightVC];
NSArray *titleArr = @[TFLocalizedString(@"详情"), TFLocalizedString(@"目录")];
self.pageContentCollectionView = [[SGPageContentCollectionView alloc] initWithFrame:CGRectMake(0, 44.6, self.view.width, SCREEN_HEIGHT - PUB_NAVBAR_HEIGHT - PUB_TABBAR_OFFSET - 44 - 44.6 - kQuarterMargin) parentVC:self childVCs:childArr];
self.pageContentCollectionView.delegatePageContentCollectionView = self;
[self.view addSubview:self.pageContentCollectionView];
self.pageConfigure.bottomSeparatorColor = kGrayLineColor;
self.pageConfigure.titleFont = kMainFont;
self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44) delegate:self titleNames:titleArr configure:self.pageConfigure];
self.pageTitleView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.pageTitleView];
}
- (void)setDetailModel:(TFComicDetailModel *)detailModel
{
_detailModel = detailModel;
leftVC.detailModel = self.detailModel;
rightVC.comicModel = self.detailModel.productionModel;
}
- (void)setCanScroll:(BOOL)canScroll
{
leftVC.canScroll = canScroll;
rightVC.canScroll = canScroll;
}
- (void)setContentOffSetY:(CGFloat)contentOffSetY
{
rightVC.contentOffSetY = contentOffSetY;
}
- (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex {
[self.pageContentCollectionView setPageContentCollectionViewCurrentIndex:selectedIndex];
}
- (void)pageContentCollectionView:(SGPageContentCollectionView *)pageContentCollectionView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex {
[self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex];
}
@end