酷店

KDPTodayLiveDataVC.m 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //
  2. // KDPTodayLiveDataVC.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/9.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPTodayLiveDataVC.h"
  9. #import "XLPageViewController.h"
  10. #import "KDPCollectHistoryVC.h"
  11. @interface KDPTodayLiveDataVC ()<XLPageViewControllerDelegate,XLPageViewControllerDataSrouce>
  12. {
  13. NSArray *titleArray;
  14. }
  15. @property (nonatomic, strong) XLPageViewController *pageVC;
  16. @end
  17. @implementation KDPTodayLiveDataVC
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. [self.navBar addleftReturnButton:self selector:@selector(returnClickBtn)];
  21. self.navBar.navTitleLabel.text=@"今日直播数据";
  22. [self setUpPageVc];
  23. }
  24. - (void)setUpPageVc{
  25. self.navBar.hidden=NO;
  26. self.view.backgroundColor=[UIColor whiteColor];
  27. titleArray=@[@"实时订单",@"热销商品",@"销量走势"];
  28. XLPageViewControllerConfig *config = [[XLPageViewControllerConfig alloc] init];
  29. //标题间距
  30. config.titleSpace = 25;
  31. config.titleViewStyle = XLPageTitleViewStyleBasic;
  32. //标题高度
  33. config.titleViewHeight = 40;
  34. //标题选中颜色
  35. config.titleSelectedColor = [UIColor colorWithHexString:ThemeColor];
  36. //标题选中字体
  37. config.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size: 14];
  38. //标题正常颜色
  39. config.titleNormalColor = [UIColor colorWithHexString:@"#5B5B5B"];
  40. //标题正常字体
  41. config.titleNormalFont = [UIFont fontWithName:@"PingFang-SC-Medium" size: 14];
  42. config.titleViewInset = UIEdgeInsetsMake(0, 10, 0, 10);
  43. //阴影颜色
  44. config.shadowLineColor = [UIColor colorWithHexString:@"#5B5B5B"];
  45. //阴影宽度
  46. config.shadowLineWidth = 24;
  47. //阴影末端是直角
  48. config.shadowLineCap = XLPageShadowLineCapSquare;
  49. //分割线颜色
  50. config.separatorLineHidden = YES;
  51. config.shadowLineHeight = 2;
  52. config.showTitleInNavigationBar = NO;
  53. config.shadowLineAnimationType = XLPageShadowLineAnimationTypeZoom;
  54. config.navHeight=KDNavBarHeight;
  55. config.contentHeight=SCREEN_HEIGHT-KDNavBarHeight;
  56. config.shadowLineColor=[UIColor colorWithHexString:ThemeColor];
  57. self.pageVC = [[XLPageViewController alloc] initWithConfig:config];
  58. self.pageVC.view.bounds = CGRectMake(0, KDNavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT);
  59. self.pageVC.delegate = self;
  60. self.pageVC.dataSource = self;
  61. [self addChildViewController:self.pageVC];
  62. [self.view addSubview:self.pageVC.view];
  63. }
  64. -(void)returnClickBtn
  65. {
  66. [self.navigationController popViewControllerAnimated:YES];
  67. }
  68. #pragma mark - XLPageViewController datasource and delegate
  69. - (NSInteger)pageViewControllerNumberOfPage{
  70. return titleArray.count;
  71. }
  72. - (NSString *)pageViewController:(XLPageViewController *)pageViewController titleForIndex:(NSInteger)index{
  73. return titleArray[index];
  74. }
  75. - (void)pageViewController:(XLPageViewController *)pageViewController didSelectedAtIndex:(NSInteger)index{
  76. NSLog(@"%ld",index);
  77. }
  78. - (UIViewController *)pageViewController:(XLPageViewController *)pageViewController viewControllerForIndex:(NSInteger)index{
  79. KDPTodayListViewController *contentVC = [[KDPTodayListViewController alloc] init];
  80. contentVC.todayStr=titleArray[index];
  81. return contentVC;
  82. }
  83. -(void)viewWillAppear:(BOOL)animated
  84. {
  85. [super viewWillAppear:animated];
  86. self.navigationController.navigationBar.hidden=YES;
  87. self.tabBarController.tabBar.hidden=YES;
  88. }
  89. -(void)viewWillDisappear:(BOOL)animated
  90. {
  91. [super viewWillDisappear:animated];
  92. self.tabBarController.tabBar.hidden=NO;
  93. }
  94. @end