酷店

KDPLiveDataViewController.m 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // KDPLiveDataViewController.m
  3. // KuDianProject
  4. //
  5. // Created by admin on 2019/7/4.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPLiveDataViewController.h"
  9. #import "XLPageViewController.h"
  10. #import "KDPLiveLeftViewController.h"
  11. #import "KDPLiveRightViewController.h"
  12. @interface KDPLiveDataViewController ()<XLPageViewControllerDelegate,XLPageViewControllerDataSrouce>
  13. @property (nonatomic, strong) XLPageViewController *pageVC;
  14. @end
  15. @implementation KDPLiveDataViewController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. // Do any additional setup after loading the view.
  19. [self setContentView];
  20. }
  21. - (void)setContentView{
  22. self.navBar.hidden = YES;
  23. UIView *topBackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, KDNavBarHeight)];
  24. [topBackView setGradientBackgroundWithColors:@[[UIColor colorWithHex:0xFF235F],[UIColor colorWithHex:0xFF7676]] locations:@[@0,@1] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
  25. [self.view addSubview:topBackView];
  26. [self addChildViewController:self.pageVC];
  27. [self.view addSubview:self.pageVC.view];
  28. }
  29. - (XLPageViewController *)pageVC{
  30. if (!_pageVC) {
  31. XLPageViewControllerConfig *config = [[XLPageViewControllerConfig alloc] init];
  32. //标题间距
  33. config.titleSpace = 100;
  34. config.titleViewStyle = XLPageTitleViewStyleBasic;
  35. //标题高度
  36. config.titleViewHeight = 40;
  37. //标题选中颜色
  38. config.titleSelectedColor = [UIColor whiteColor];
  39. //标题选中字体
  40. config.titleSelectedFont = [UIFont fontWithName:@"PingFangSC-Semibold" size: 16];
  41. //标题正常颜色
  42. config.titleNormalColor = [UIColor whiteColor];
  43. //标题正常字体
  44. config.titleNormalFont = [UIFont fontWithName:@"PingFangSC-Regular" size: 16];
  45. config.titleViewInset = UIEdgeInsetsMake(0, 73, 0, 73);
  46. //阴影颜色
  47. config.shadowLineColor = [UIColor colorWithHex:0xFFB444];
  48. //阴影宽度
  49. config.shadowLineWidth = 15;
  50. //阴影末端是直角
  51. config.shadowLineCap = XLPageShadowLineCapSquare;
  52. config.showTitleInNavigationBar = NO;
  53. //分割线颜色
  54. config.separatorLineHidden = YES;
  55. config.shadowLineHeight = 2;
  56. config.shadowLineAnimationType = XLPageShadowLineAnimationTypePan;
  57. config.separatorLineBottomMargin = 5;
  58. _pageVC = [[XLPageViewController alloc] initWithConfig:config];
  59. _pageVC.view.bounds = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-KDTabBarHeight+1);
  60. _pageVC.delegate = self;
  61. _pageVC.dataSource = self;
  62. }
  63. return _pageVC;
  64. }
  65. #pragma mark - XLPageViewController datasource and delegate
  66. - (NSInteger)pageViewControllerNumberOfPage{
  67. NSArray *array = @[@"基础数据",@"商品统计"];
  68. return array.count;
  69. }
  70. - (NSString *)pageViewController:(XLPageViewController *)pageViewController titleForIndex:(NSInteger)index{
  71. NSArray *array = @[@"基础数据",@"商品统计"];
  72. return array[index];
  73. }
  74. - (void)pageViewController:(XLPageViewController *)pageViewController didSelectedAtIndex:(NSInteger)index{
  75. NSLog(@"%ld",index);
  76. }
  77. - (UIViewController *)pageViewController:(XLPageViewController *)pageViewController viewControllerForIndex:(NSInteger)index{
  78. if (index == 0) {
  79. KDPLiveLeftViewController *leftVC = [[KDPLiveLeftViewController alloc] init];
  80. return leftVC;
  81. } else if(index == 1) {
  82. KDPLiveRightViewController *rightVC = [[KDPLiveRightViewController alloc] init];
  83. return rightVC;
  84. }
  85. UIViewController *contentVC = [[UIViewController alloc] init];
  86. return contentVC;
  87. }
  88. @end