CourseTimeSegView.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // CourseTimeSegView.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by 王智 on 2022/6/22.
  6. //
  7. #import "CourseTimeSegView.h"
  8. @interface CourseTimeSegView ()
  9. @property (weak, nonatomic) IBOutlet UIImageView *arrowImage;
  10. @property (nonatomic, copy) CourseTimeSearchCallback callback;
  11. @end
  12. @implementation CourseTimeSegView
  13. - (void)awakeFromNib {
  14. [super awakeFromNib];
  15. self.arrowUp = NO;
  16. }
  17. + (instancetype)shareInstance {
  18. CourseTimeSegView *view = [[[NSBundle mainBundle] loadNibNamed:@"CourseTimeSegView" owner:nil options:nil] firstObject];
  19. return view;
  20. }
  21. - (void)sortAction:(CourseTimeSearchCallback)callback {
  22. if (callback) {
  23. self.callback = callback;
  24. }
  25. }
  26. - (void)setArrowUp:(BOOL)arrowUp {
  27. _arrowUp = arrowUp;
  28. NSString *imageName = arrowUp ? @"sort_up" : @"sort_down";
  29. [_arrowImage setImage:[UIImage imageNamed:imageName]];
  30. }
  31. - (IBAction)buttonClickAction:(id)sender {
  32. if (self.callback) {
  33. self.callback();
  34. }
  35. }
  36. /*
  37. // Only override drawRect: if you perform custom drawing.
  38. // An empty implementation adversely affects performance during animation.
  39. - (void)drawRect:(CGRect)rect {
  40. // Drawing code
  41. }
  42. */
  43. @end