JXCategoryTitleBackgroundView.m 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // JXCategoryTitleBackgroundView.m
  3. // JXCategoryView
  4. //
  5. // Created by jiaxin on 2019/8/16.
  6. // Copyright © 2019 jiaxin. All rights reserved.
  7. //
  8. #import "JXCategoryTitleBackgroundView.h"
  9. @implementation JXCategoryTitleBackgroundView
  10. - (void)initializeData {
  11. [super initializeData];
  12. self.cellWidthIncrement = 0;
  13. self.normalBackgroundColor = [UIColor whiteColor];
  14. self.normalBorderColor = RQ_MAIN_LINE_COLOR_1;
  15. self.selectedBackgroundColor = RQ_MAIN_COLOR;
  16. self.selectedBorderColor = RQ_MAIN_COLOR;
  17. self.borderLineWidth = 1;
  18. self.backgroundCornerRadius = 3;
  19. self.backgroundWidth = JXCategoryViewAutomaticDimension;
  20. self.backgroundHeight = 37;
  21. }
  22. //返回自定义的cell class
  23. - (Class)preferredCellClass {
  24. return [JXCategoryTitleBackgroundCell class];
  25. }
  26. - (void)refreshDataSource {
  27. NSMutableArray *tempArray = [NSMutableArray array];
  28. for (int i = 0; i < self.titles.count; i++) {
  29. JXCategoryTitleBackgroundCellModel *cellModel = [[JXCategoryTitleBackgroundCellModel alloc] init];
  30. [tempArray addObject:cellModel];
  31. }
  32. self.dataSource = tempArray;
  33. }
  34. - (void)refreshCellModel:(JXCategoryBaseCellModel *)cellModel index:(NSInteger)index {
  35. [super refreshCellModel:cellModel index:index];
  36. JXCategoryTitleBackgroundCellModel *myModel = (JXCategoryTitleBackgroundCellModel *)cellModel;
  37. myModel.normalBackgroundColor = self.normalBackgroundColor;
  38. myModel.normalBorderColor = self.normalBorderColor;
  39. myModel.selectedBackgroundColor = self.selectedBackgroundColor;
  40. myModel.selectedBorderColor = self.selectedBorderColor;
  41. myModel.borderLineWidth = self.borderLineWidth;
  42. myModel.backgroundCornerRadius = self.backgroundCornerRadius;
  43. myModel.backgroundWidth = self.backgroundWidth;
  44. myModel.backgroundHeight = self.backgroundHeight;
  45. }
  46. @end