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.
 

87 lines
3.0 KiB

//
// TFAudioDetailFooterView.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/25.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFAudioDetailFooterView.h"
#import "TFAudioRecommendedViewController.h"
#import "TFAudioDirectoryViewController.h"
@interface TFAudioDetailFooterView ()<SGPageTitleViewDelegate, SGPageContentCollectionViewDelegate>
{
TFAudioRecommendedViewController *rightVC;
TFAudioDirectoryViewController *leftVC;
}
@property (nonatomic ,strong) SGPageTitleView *pageTitleView;
@property (nonatomic ,strong) SGPageContentCollectionView *pageContentCollectionView;
@end
@implementation TFAudioDetailFooterView
- (void)viewDidLoad
{
[super viewDidLoad];
[self hiddenNavigationBar:YES];
[self createSubViews];
}
- (void)createSubViews
{
leftVC = [[TFAudioDirectoryViewController alloc] init];
leftVC.directoryModel = self.directoryModel;
[self addChildViewController:leftVC];
rightVC = [[TFAudioRecommendedViewController alloc] init];
rightVC.productionType = TFProductionTypeAudio;
[self addChildViewController:rightVC];
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 - 44) parentVC:self childVCs:childArr];
self.pageContentCollectionView.delegatePageContentCollectionView = self;
[self.view addSubview:self.pageContentCollectionView];
self.pageConfigure.bottomSeparatorColor = kGrayLineColor;
self.pageConfigure.titleFont = kMainFont;
self.pageConfigure.titleSelectedColor = kBlackColor;
self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44) delegate:self titleNames:titleArr configure:self.pageConfigure];
self.pageTitleView.backgroundColor = [UIColor whiteColor];
[self.pageTitleView addRoundingCornersWithRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)];
[self.view addSubview:self.pageTitleView];
}
- (void)setDirectoryModel:(TFProductionModel *)directoryModel
{
_directoryModel = directoryModel;
leftVC.directoryModel = directoryModel;
}
- (void)setAudio_id:(NSInteger)audio_id
{
_audio_id = audio_id;
leftVC.audio_id = self.audio_id;
}
- (void)setCanScroll:(BOOL)canScroll
{
rightVC.canScroll = canScroll;
leftVC.canScroll = canScroll;
}
- (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