ArrangeRecentRankButtonView.m 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // ArrangeRecentRankButtonView.m
  3. // KulexiuForStudent
  4. //
  5. // Created by 王智 on 2024/11/19.
  6. //
  7. #import "ArrangeRecentRankButtonView.h"
  8. @interface ArrangeRecentRankButtonView ()
  9. @property (weak, nonatomic) IBOutlet UIView *bgView;
  10. @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
  11. @property (nonatomic, copy) RankRecentCallback callback;
  12. @end
  13. @implementation ArrangeRecentRankButtonView
  14. + (instancetype)sharedInstance {
  15. ArrangeRecentRankButtonView *view = [[[NSBundle mainBundle] loadNibNamed:@"ArrangeRecentRankButtonView" owner:nil options:nil] firstObject];
  16. return view;
  17. }
  18. - (void)settingCallback:(RankRecentCallback)callback {
  19. if (callback) {
  20. self.callback = callback;
  21. }
  22. }
  23. - (IBAction)butonAction:(id)sender {
  24. self.isChoose = !self.isChoose;
  25. if (self.callback) {
  26. self.callback(self.isChoose);
  27. }
  28. }
  29. - (void)setIsChoose:(BOOL)isChoose {
  30. _isChoose = isChoose;
  31. if (isChoose) {
  32. self.bgView.backgroundColor = HexRGB(0xE8FFFB);
  33. self.bgView.layer.borderColor = THEMECOLOR.CGColor;
  34. self.titleLabel.textColor = HexRGB(0x18B99A);
  35. self.titleLabel.font = [UIFont systemFontOfSize:12.0f weight:UIFontWeightMedium];
  36. }
  37. else {
  38. self.bgView.backgroundColor = HexRGB(0xffffff);
  39. self.bgView.layer.borderColor = [UIColor clearColor].CGColor;
  40. self.titleLabel.textColor = HexRGB(0x333333);
  41. self.titleLabel.font = [UIFont systemFontOfSize:12.0f weight:UIFontWeightRegular];
  42. }
  43. }
  44. + (CGFloat)getViewHeight {
  45. return 28.0f;
  46. }
  47. /*
  48. // Only override drawRect: if you perform custom drawing.
  49. // An empty implementation adversely affects performance during animation.
  50. - (void)drawRect:(CGRect)rect {
  51. // Drawing code
  52. }
  53. */
  54. @end