酷店

KDPCollectHistoryPageVC.m 3.7KB

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