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.
 

93 lines
2.9 KiB

//
// TFLimitFreeViewController.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/17.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFLimitFreeViewController.h"
#import "TFLimitFreeCommController.h"
#import "SGPagingView.h"
@interface TFLimitFreeViewController ()<
#if TF_Enable_PageControl
SGPageTitleViewDelegate,
#endif
SGPageContentCollectionViewDelegate>
#if TF_Enable_PageControl
@property (nonatomic ,strong) SGPageTitleView *pageTitleView;
#endif
@property (nonatomic ,strong) SGPageContentCollectionView *pageContentCollectionView;
@end
@implementation TFLimitFreeViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self initialize];
[self createSubviews];
}
- (void)initialize
{
[self setNavigationBarTitle:TFLocalizedString(@"限时免费")];
[self hiddenSeparator];
}
- (void)createSubviews
{
TFLimitFreeCommController *boyVC = [[TFLimitFreeCommController alloc] init];
boyVC.channel = @"1";
boyVC.productionType = self.productionType;
#if TF_Enable_PageControl
TFLimitFreeCommController *girlVC = [[TFLimitFreeCommController alloc] init];
girlVC.channel = @"2";
girlVC.productionType = self.productionType;
#endif
NSArray *childArr = @[boyVC
#if TF_Enable_PageControl
, girlVC
#endif
];
self.pageContentCollectionView = [[SGPageContentCollectionView alloc] initWithFrame:
#if TF_Enable_PageControl
CGRectMake(0, PUB_NAVBAR_HEIGHT + 44, SCREEN_WIDTH, SCREEN_HEIGHT)
#else
CGRectMake(0, PUB_NAVBAR_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)
#endif
parentVC:self childVCs:childArr];
_pageContentCollectionView.delegatePageContentCollectionView = self;
[self.view addSubview:self.pageContentCollectionView];
#if TF_Enable_PageControl
NSArray *titleArr = @[TFLocalizedString(@"男生"), TFLocalizedString(@"女生")];
self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, PUB_NAVBAR_HEIGHT, SCREEN_WIDTH, 44) delegate:self titleNames:titleArr configure:self.pageConfigure];
self.pageTitleView.backgroundColor = kWhiteColor;
[self.view addSubview:_pageTitleView];
if (TFSystemInfoManager.sexChannel == 2) {
[self.pageTitleView setSelectedIndex:1];
}
#endif
}
#if TF_Enable_PageControl
- (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];
}
#endif
@end