RQHomeSubPageVideoCell.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // RQHomeSubPageVideoCell.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2021/11/9.
  6. //
  7. #import "RQHomeSubPageVideoCell.h"
  8. @interface RQHomeSubPageVideoCell ()
  9. @property (nonatomic, readwrite, strong) RQHomeSubPageVideoItemViewModel *viewModel;
  10. @property (weak, nonatomic) IBOutlet UIImageView *videoImageView;
  11. @property (weak, nonatomic) IBOutlet UILabel *videoDurationLabel;
  12. @property (weak, nonatomic) IBOutlet UILabel *myTtitleLabel;
  13. @end
  14. @implementation RQHomeSubPageVideoCell
  15. #pragma mark - PublicMethods
  16. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  17. static NSString *ID = @"RQHomeSubPageVideoCell";
  18. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  19. RQHomeSubPageVideoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  20. if (!cell) cell = [self rq_viewFromXib];
  21. return cell;
  22. }
  23. - (void)bindViewModel:(RQHomeSubPageVideoItemViewModel *)viewModel {
  24. _viewModel = viewModel;
  25. [_videoImageView yy_setImageWithURL:[NSURL URLWithString:viewModel.videosItem.coverFileUrl] placeholder:RQWebVideoImagePlaceholder()];
  26. _videoDurationLabel.text = [NSString getMMSSFromSS:viewModel.videosItem.videoDuration];
  27. _myTtitleLabel.text = viewModel.videosItem.title;
  28. [self layoutIfNeeded];
  29. }
  30. #pragma mark - SystemMethods
  31. - (void)awakeFromNib {
  32. [super awakeFromNib];
  33. // Initialization code
  34. }
  35. @end