RQHomeSubPageVideoCell.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. }
  29. #pragma mark - SystemMethods
  30. - (void)awakeFromNib {
  31. [super awakeFromNib];
  32. // Initialization code
  33. }
  34. @end