酷店

KDPCollectHistoryPageVC.m 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. UIButton *returnBtn =[[UIButton alloc]initWithFrame:CGRectMake(0, KDStatusHeight, 0, 0)];
  22. [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal];
  23. [returnBtn addTarget:self action:@selector(returnClickBtn) forControlEvents:UIControlEventTouchUpInside];
  24. self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithCustomView:returnBtn]; self.navigationController.navigationBar.barTintColor=[UIColor gradientOneColor:[UIColor colorWithHexString:@"#FF235F"] toColor:[UIColor colorWithHexString:@"#FF7676"] Width:SCREEN_WIDTH];
  25. }
  26. - (void)setUpPageVc{
  27. self.navBar.hidden=YES;
  28. titleArray=@[@"收藏夹",@"浏览记录"];
  29. [UIApplication sharedApplication].statusBarStyle=UIStatusBarStyleDefault;
  30. XLPageViewControllerConfig *config = [[XLPageViewControllerConfig alloc] init];
  31. //标题间距
  32. config.titleSpace = 25;
  33. config.titleViewStyle = XLPageTitleViewStyleBasic;
  34. //标题高度
  35. config.titleViewHeight = 40;
  36. //标题选中颜色
  37. config.titleSelectedColor = [UIColor whiteColor];
  38. //标题选中字体
  39. config.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size: 17];
  40. //标题正常颜色
  41. config.titleNormalColor = [UIColor whiteColor];
  42. //标题正常字体
  43. config.titleNormalFont = [UIFont fontWithName:@"PingFang-SC-Medium" size: 14];
  44. config.titleViewInset = UIEdgeInsetsMake(0, 10, 0, 10);
  45. //阴影颜色
  46. config.shadowLineColor = [UIColor whiteColor];
  47. //阴影宽度
  48. config.shadowLineWidth = 24;
  49. //阴影末端是直角
  50. config.shadowLineCap = XLPageShadowLineCapSquare;
  51. //分割线颜色
  52. config.separatorLineHidden = YES;
  53. config.shadowLineHeight = 3;
  54. config.showTitleInNavigationBar=YES;
  55. config.shadowLineAnimationType = XLPageShadowLineAnimationTypeZoom;
  56. config.titleViewAlignment=XLPageTitleViewAlignmentCenter;
  57. // config.navHeight=KDNavBarHeight;
  58. // config.contentHeight=SCREEN_HEIGHT-KDNavBarHeight;
  59. self.pageVC = [[XLPageViewController alloc] initWithConfig:config];
  60. self.pageVC.view.bounds = CGRectMake(0, KDNavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT);
  61. self.pageVC.delegate = self;
  62. self.pageVC.dataSource = self;
  63. [self addChildViewController:self.pageVC];
  64. [self.view addSubview:self.pageVC.view];
  65. }
  66. -(void)returnClickBtn
  67. {
  68. [self.navigationController popViewControllerAnimated:YES];
  69. }
  70. #pragma mark - XLPageViewController datasource and delegate
  71. - (NSInteger)pageViewControllerNumberOfPage{
  72. return titleArray.count;
  73. }
  74. - (NSString *)pageViewController:(XLPageViewController *)pageViewController titleForIndex:(NSInteger)index{
  75. return titleArray[index];
  76. }
  77. - (void)pageViewController:(XLPageViewController *)pageViewController didSelectedAtIndex:(NSInteger)index{
  78. NSLog(@"%ld",(long)index);
  79. }
  80. - (UIViewController *)pageViewController:(XLPageViewController *)pageViewController viewControllerForIndex:(NSInteger)index{
  81. KDPCollectHistoryVC *contentVC = [[KDPCollectHistoryVC alloc] init];
  82. contentVC.pagetype=titleArray[index];
  83. return contentVC;
  84. }
  85. -(void)viewWillAppear:(BOOL)animated
  86. {
  87. [super viewWillAppear:animated];
  88. self.navigationController.navigationBar.hidden=NO;
  89. [UIApplication sharedApplication].statusBarStyle=UIStatusBarStyleLightContent;
  90. self.tabBarController.tabBar.hidden=YES;
  91. }
  92. -(void)viewWillDisappear:(BOOL)animated
  93. {
  94. [super viewWillDisappear:animated];
  95. self.tabBarController.tabBar.hidden=NO;
  96. self.navigationController.navigationBar.hidden=NO;
  97. self.view.frame=[UIScreen mainScreen].bounds;
  98. }
  99. @end