HomeIntroduceView.m 1008 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // HomeIntroduceView.m
  3. // KulexiuForStudent
  4. //
  5. // Created by 王智 on 2022/4/21.
  6. //
  7. #import "HomeIntroduceView.h"
  8. @interface HomeIntroduceView ()
  9. @property (nonatomic, copy) HomeIntroduceMoreBlock callback;
  10. @end
  11. @implementation HomeIntroduceView
  12. + (instancetype)shareInstance {
  13. HomeIntroduceView *view = [[[NSBundle mainBundle] loadNibNamed:@"HomeIntroduceView" owner:nil options:nil] firstObject];
  14. return view;
  15. }
  16. - (void)introduceMore:(HomeIntroduceMoreBlock)callback {
  17. if (callback) {
  18. self.callback = callback;
  19. }
  20. }
  21. - (CGFloat)getViewHeightWithSourceCount:(NSInteger)count {
  22. NSInteger row = count / 2 + count % 2;
  23. return 56 + row * 164 + (row - 1) * 12;
  24. }
  25. - (IBAction)moreAction:(id)sender {
  26. if (self.callback) {
  27. self.callback();
  28. }
  29. }
  30. /*
  31. // Only override drawRect: if you perform custom drawing.
  32. // An empty implementation adversely affects performance during animation.
  33. - (void)drawRect:(CGRect)rect {
  34. // Drawing code
  35. }
  36. */
  37. @end