// // KDPTodayLiveDataVC.m // KuDianProject // // Created by 学丽 on 2019/7/9. // Copyright © 2019 KDP. All rights reserved. // #import "KDPTodayLiveDataVC.h" #import "XLPageViewController.h" #import "KDPCollectHistoryVC.h" @interface KDPTodayLiveDataVC () { NSArray *titleArray; } @property (nonatomic, strong) XLPageViewController *pageVC; @end @implementation KDPTodayLiveDataVC - (void)viewDidLoad { [super viewDidLoad]; [self.navBar addleftReturnButton:self selector:@selector(returnClickBtn)]; self.navBar.navTitleLabel.text=@"今日直播数据"; [self setUpPageVc]; } - (void)setUpPageVc{ self.navBar.hidden=NO; self.view.backgroundColor=[UIColor whiteColor]; titleArray=@[@"实时订单",@"热销商品",@"销量走势"]; XLPageViewControllerConfig *config = [[XLPageViewControllerConfig alloc] init]; //标题间距 config.titleSpace = 25; config.titleViewStyle = XLPageTitleViewStyleBasic; //标题高度 config.titleViewHeight = 40; //标题选中颜色 config.titleSelectedColor = [UIColor colorWithHexString:ThemeColor]; //标题选中字体 config.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size: 14]; //标题正常颜色 config.titleNormalColor = [UIColor colorWithHexString:@"#5B5B5B"]; //标题正常字体 config.titleNormalFont = [UIFont fontWithName:@"PingFang-SC-Medium" size: 14]; config.titleViewInset = UIEdgeInsetsMake(0, 10, 0, 10); //阴影颜色 config.shadowLineColor = [UIColor colorWithHexString:@"#5B5B5B"]; //阴影宽度 config.shadowLineWidth = 24; //阴影末端是直角 config.shadowLineCap = XLPageShadowLineCapSquare; //分割线颜色 config.separatorLineHidden = YES; config.shadowLineHeight = 2; config.showTitleInNavigationBar = NO; config.shadowLineAnimationType = XLPageShadowLineAnimationTypeZoom; config.navHeight=KDNavBarHeight; config.contentHeight=SCREEN_HEIGHT-KDNavBarHeight; config.shadowLineColor=[UIColor colorWithHexString:ThemeColor]; 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",index); } - (UIViewController *)pageViewController:(XLPageViewController *)pageViewController viewControllerForIndex:(NSInteger)index{ KDPTodayListViewController *contentVC = [[KDPTodayListViewController alloc] init]; contentVC.todayStr=titleArray[index]; return contentVC; } -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.navigationController.navigationBar.hidden=YES; self.tabBarController.tabBar.hidden=YES; } -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; self.tabBarController.tabBar.hidden=NO; } @end