YOUPAILZDynamicVC.m 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // YOUPAILZDynamicVC.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/7/1.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZDynamicVC.h"
  9. #import "JXCategoryView.h"
  10. #import "YOUPAIJXCategoryTitleBackgroundView.h"
  11. #import "JXCategoryListContainerView.h"
  12. #import "YOUPAILCBaseDynamicVC.h"
  13. @interface YOUPAILZDynamicVC ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
  14. @end
  15. @implementation YOUPAILZDynamicVC
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. self.view.backgroundColor = [UIColor whiteColor];
  19. [self youpaifinitUI];
  20. }
  21. - (void)youpaifinitUI{
  22. YOUPAIJXCategoryTitleBackgroundView *categoryView = [[YOUPAIJXCategoryTitleBackgroundView alloc] init];//WithFrame:CGRectMake(0.0f, 14.0f, KScreenWidth, 26.0f)
  23. categoryView.backgroundColor = [UIColor clearColor];
  24. categoryView.titles = self.titles;
  25. categoryView.delegate = self;
  26. categoryView.titleColor = [UIColor whiteColor];
  27. categoryView.titleColorGradientEnabled = YES;
  28. categoryView.titleLabelMaskEnabled = YES;
  29. categoryView.titleFont = LCFont(14.0f);
  30. categoryView.cellWidth = 50.0f;
  31. categoryView.cellSpacing = 14.0f;
  32. categoryView.averageCellSpacingEnabled = NO;
  33. categoryView.normalBackgroundColor = [HexColorFromRGB(0x4F4B5B) colorWithAlphaComponent:0.38f];
  34. categoryView.selectedBackgroundColor = [HexColorFromRGB(0xF4003F) colorWithAlphaComponent:0.14f];
  35. categoryView.cellWidthIncrement = 0;
  36. categoryView.normalBorderColor = [UIColor clearColor];
  37. categoryView.selectedBorderColor = [UIColor clearColor];
  38. categoryView.borderLineWidth = 0;
  39. categoryView.backgroundCornerRadius = 13.0f;
  40. categoryView.backgroundWidth = JXCategoryViewAutomaticDimension;
  41. categoryView.backgroundHeight = 26.0f;
  42. JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
  43. pagerView.listCellBackgroundColor = LCBkgColor;
  44. // pagerView.frame = CGRectMake(0.0f, CGRectGetMaxY(categoryView.frame) + 14.0f, KScreenWidth, KScreenHeight - CGRectGetMaxY(categoryView.frame) - NavBarHeight - 10.0f - TabbarHeight - 14.0f);
  45. [self.view addSubview:pagerView];
  46. categoryView.listContainer = pagerView;
  47. [self.view addSubview:categoryView];
  48. [categoryView mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.left.right.offset(0.0f);
  50. make.top.offset(14.0f + NavBarHeight + 10.0f);
  51. make.height.offset(26.0f);
  52. }];
  53. [pagerView mas_makeConstraints:^(MASConstraintMaker *make) {
  54. make.left.right.bottom.offset(0.0f);
  55. make.top.equalTo(categoryView.mas_bottom).offset(14.0f);
  56. }];
  57. }
  58. #pragma mark - JXCategoryListContainerViewDelegate
  59. - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
  60. return self.titles.count;
  61. }
  62. - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
  63. YOUPAILCBaseDynamicVC *dynamicVC = [[YOUPAILCBaseDynamicVC alloc] init];
  64. dynamicVC.youpaiptype = [self.types[index] integerValue];
  65. return dynamicVC;
  66. }
  67. - (UIView *)listView{
  68. return self.view;
  69. }
  70. - (NSArray <NSString *> *)titles{
  71. return @[@"全部",@"关注",@"同城"];
  72. }
  73. - (NSArray <NSNumber *> *)types{
  74. return @[@(1),@(2),@(0)];
  75. }
  76. @end