You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5 KiB

  1. //
  2. // FLEXTableContentHeaderCell.m
  3. // FLEX
  4. //
  5. // Created by Peng Tao on 15/11/26.
  6. // Copyright © 2015f. All rights reserved.
  7. //
  8. #import "FLEXTableColumnHeader.h"
  9. @implementation FLEXTableColumnHeader
  10. {
  11. UILabel *_arrowLabel;
  12. }
  13. - (instancetype)initWithFrame:(CGRect)frame
  14. {
  15. self = [super initWithFrame:frame];
  16. if (self) {
  17. self.backgroundColor = [UIColor whiteColor];
  18. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, frame.size.width - 25, frame.size.height)];
  19. label.font = [UIFont systemFontOfSize:13.0];
  20. [self addSubview:label];
  21. self.label = label;
  22. _arrowLabel = [[UILabel alloc] initWithFrame:CGRectMake(frame.size.width - 20, 0, 20, frame.size.height)];
  23. _arrowLabel.font = [UIFont systemFontOfSize:13.0];
  24. [self addSubview:_arrowLabel];
  25. UIView *line = [[UIView alloc] initWithFrame:CGRectMake(frame.size.width - 1, 2, 1, frame.size.height - 4)];
  26. line.backgroundColor = [UIColor colorWithWhite:0.803 alpha:0.850];
  27. [self addSubview:line];
  28. }
  29. return self;
  30. }
  31. - (void)changeSortStatusWithType:(FLEXTableColumnHeaderSortType)type
  32. {
  33. switch (type) {
  34. case FLEXTableColumnHeaderSortTypeNone:
  35. _arrowLabel.text = @"";
  36. break;
  37. case FLEXTableColumnHeaderSortTypeAsc:
  38. _arrowLabel.text = @"⬆️";
  39. break;
  40. case FLEXTableColumnHeaderSortTypeDesc:
  41. _arrowLabel.text = @"⬇️";
  42. break;
  43. }
  44. }
  45. @end