RQHomePageOneOrFourBigCell.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // RQHomePageOneOrFourBigCell.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/6/10.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQHomePageOneOrFourBigCell.h"
  9. @interface RQHomePageOneOrFourBigCell ()
  10. @property (nonatomic, readwrite, strong) RQHomePageOneOrFourBigItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UILabel *mtTitleLabel;
  12. @property (weak, nonatomic) IBOutlet UIImageView *myBgImageView;
  13. @property (weak, nonatomic) IBOutlet UIStackView *leftStackView;
  14. @property (weak, nonatomic) IBOutlet UILabel *leftLabel;
  15. @property (weak, nonatomic) IBOutlet UILabel *rightLabel;
  16. @end
  17. @implementation RQHomePageOneOrFourBigCell
  18. #pragma mark - PublicMethods
  19. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  20. static NSString *ID = @"RQHomePageOneOrFourBigCell";
  21. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  22. RQHomePageOneOrFourBigCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  23. if (!cell) cell = [self rq_viewFromXib];
  24. return cell;
  25. }
  26. - (void)bindViewModel:(RQHomePageOneOrFourBigItemViewModel *)viewModel {
  27. _viewModel = viewModel;
  28. _mtTitleLabel.text = viewModel.title;
  29. _myBgImageView.image = RQImageNamed(viewModel.icon);
  30. RAC(self.leftLabel, attributedText) = [[RACObserve(viewModel, leftStr) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
  31. RAC(self.rightLabel, attributedText) = [[RACObserve(viewModel, rightStr) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
  32. }
  33. #pragma mark - SystemMethods
  34. - (void)awakeFromNib {
  35. [super awakeFromNib];
  36. // Initialization code
  37. }
  38. @end