RQVideoListCell.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // RQVideoListCell.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2021/11/3.
  6. //
  7. #import "RQVideoListCell.h"
  8. @interface RQVideoListCell ()
  9. @property (nonatomic , strong) CGXVerticalMenuMoreListSectionItemModel *model;
  10. @property (weak, nonatomic) IBOutlet UIImageView *videoImageView;
  11. @property (weak, nonatomic) IBOutlet UILabel *videoTitleLabel;
  12. @property (weak, nonatomic) IBOutlet UILabel *videoDurationLabel;
  13. @end
  14. @implementation RQVideoListCell
  15. #pragma mark - Public Method
  16. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  17. static NSString *ID = @"RQVideoListCell";
  18. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  19. RQVideoListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  20. if (!cell) cell = [self rq_viewFromXib];
  21. return cell;
  22. }
  23. - (void)awakeFromNib {
  24. [super awakeFromNib];
  25. // Initialization code
  26. }
  27. - (void)reloadData:(CGXVerticalMenuMoreListSectionItemModel *)model {
  28. self.model = model;
  29. VideosItem *videosItem = (VideosItem *)model.dataModel;
  30. self.videoTitleLabel.text = videosItem.title;
  31. [self.videoImageView yy_setImageWithURL:[NSURL URLWithString:videosItem.coverFileUrl] placeholder:[UIImage imageNamed:@"videoPlaceholder"]];
  32. self.videoDurationLabel.text = [NSString getMMSSFromSS:videosItem.videoDuration];
  33. }
  34. @end