123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- //
- // KDPCollectHistoryPageVC.m
- // KuDianProject
- //
- // Created by 学丽 on 2019/7/9.
- // Copyright © 2019 KDP. All rights reserved.
- //
- #import "KDPCollectHistoryPageVC.h"
- #import "XLPageViewController.h"
- #import "KDPCollectHistoryVC.h"
- @interface KDPCollectHistoryPageVC ()<XLPageViewControllerDelegate,XLPageViewControllerDataSrouce>
- {
- NSArray *titleArray;
- }
- @property (nonatomic, strong) XLPageViewController *pageVC;
- @end
- @implementation KDPCollectHistoryPageVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self setUpPageVc];
- UIButton *returnBtn =[[UIButton alloc]initWithFrame:CGRectMake(0, KDStatusHeight, 0, 0)];
- [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal];
- [returnBtn addTarget:self action:@selector(returnClickBtn) forControlEvents:UIControlEventTouchUpInside];
- self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithCustomView:returnBtn]; self.navigationController.navigationBar.barTintColor=[UIColor gradientOneColor:[UIColor colorWithHexString:@"#FF235F"] toColor:[UIColor colorWithHexString:@"#FF7676"] Width:SCREEN_WIDTH];
- }
- - (void)setUpPageVc{
- self.navBar.hidden=YES;
- titleArray=@[@"收藏夹",@"浏览记录"];
- [UIApplication sharedApplication].statusBarStyle=UIStatusBarStyleDefault;
-
- XLPageViewControllerConfig *config = [[XLPageViewControllerConfig alloc] init];
- //标题间距
- config.titleSpace = 25;
- config.titleViewStyle = XLPageTitleViewStyleBasic;
- //标题高度
- config.titleViewHeight = 40;
- //标题选中颜色
- config.titleSelectedColor = [UIColor whiteColor];
- //标题选中字体
- config.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size: 17];
- //标题正常颜色
- config.titleNormalColor = [UIColor whiteColor];
- //标题正常字体
- config.titleNormalFont = [UIFont fontWithName:@"PingFang-SC-Medium" size: 14];
- config.titleViewInset = UIEdgeInsetsMake(0, 10, 0, 10);
- //阴影颜色
- config.shadowLineColor = [UIColor whiteColor];
- //阴影宽度
- config.shadowLineWidth = 24;
- //阴影末端是直角
- config.shadowLineCap = XLPageShadowLineCapSquare;
- //分割线颜色
- config.separatorLineHidden = YES;
- config.shadowLineHeight = 3;
- config.showTitleInNavigationBar=YES;
- config.shadowLineAnimationType = XLPageShadowLineAnimationTypeZoom;
- config.titleViewAlignment=XLPageTitleViewAlignmentCenter;
- // config.navHeight=KDNavBarHeight;
- // config.contentHeight=SCREEN_HEIGHT-KDNavBarHeight;
- self.pageVC = [[XLPageViewController alloc] initWithConfig:config];
-
- self.pageVC.view.bounds = CGRectMake(0, KDNavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT);
- self.pageVC.delegate = self;
- self.pageVC.dataSource = self;
- [self addChildViewController:self.pageVC];
- [self.view addSubview:self.pageVC.view];
- }
- -(void)returnClickBtn
- {
- [self.navigationController popViewControllerAnimated:YES];
- }
- #pragma mark - XLPageViewController datasource and delegate
- - (NSInteger)pageViewControllerNumberOfPage{
-
- return titleArray.count;
- }
- - (NSString *)pageViewController:(XLPageViewController *)pageViewController titleForIndex:(NSInteger)index{
-
- return titleArray[index];
- }
- - (void)pageViewController:(XLPageViewController *)pageViewController didSelectedAtIndex:(NSInteger)index{
- NSLog(@"%ld",(long)index);
- }
- - (UIViewController *)pageViewController:(XLPageViewController *)pageViewController viewControllerForIndex:(NSInteger)index{
- KDPCollectHistoryVC *contentVC = [[KDPCollectHistoryVC alloc] init];
- contentVC.pagetype=titleArray[index];
- return contentVC;
- }
- -(void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- self.navigationController.navigationBar.hidden=NO;
- [UIApplication sharedApplication].statusBarStyle=UIStatusBarStyleLightContent;
- self.tabBarController.tabBar.hidden=YES;
- }
- -(void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
-
- self.tabBarController.tabBar.hidden=NO;
- self.navigationController.navigationBar.hidden=NO;
- self.view.frame=[UIScreen mainScreen].bounds;
- }
- @end
|