RQDspVideoDetailCell.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // RQDspVideoDetailCell.m
  3. // JSJP
  4. //
  5. // Created by RONGQING on 2022/1/20.
  6. //
  7. #import "RQDspVideoDetailCell.h"
  8. @interface RQDspVideoDetailCell ()
  9. @property (nonatomic, readwrite, strong) RQDspVideoDetailItemViewModel *viewModel;
  10. @property (weak, nonatomic) IBOutlet UIImageView *coverImageView;
  11. @end
  12. @implementation RQDspVideoDetailCell
  13. #pragma mark - PublicMethods
  14. + (instancetype)cellWithTableView:(UITableView *)tableView {
  15. static NSString *ID = @"RQDspVideoDetailCell";
  16. RQDspVideoDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  17. if (!cell) {
  18. cell = [self rq_viewFromXib];
  19. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  20. cell.coverImageView.userInteractionEnabled = YES;
  21. cell.coverImageView.tag = 10086;
  22. }
  23. return cell;
  24. }
  25. - (void)bindViewModel:(RQDspVideoDetailItemViewModel *)viewModel {
  26. _viewModel = viewModel;
  27. if (RQStringIsNotEmpty(viewModel.videosItem.coverFileUrl)) {
  28. if (RQObjectIsNil(viewModel.videosItem.adView)) {
  29. [_coverImageView yy_setImageWithURL:[NSURL URLWithString:viewModel.videosItem.coverFileUrl] placeholder:RQWebVideoImagePlaceholder() options:RQWebImageOptionAutomatic completion:nil];
  30. } else {
  31. self.adView = viewModel.videosItem.adView;
  32. }
  33. }
  34. }
  35. - (void)setAdView:(UIView *)adView {
  36. if(_adView == adView)
  37. return;
  38. if(_adView.superview == self)
  39. [_adView removeFromSuperview];
  40. _adView = adView;
  41. [self.contentView addSubview:adView];
  42. if(RQ_IS_IPHONE_IPhoneX_All){
  43. adView.frame = CGRectMake(0, 60, RQ_SCREEN_WIDTH, RQ_SCREEN_HEIGHT-120);
  44. }else{
  45. adView.frame = CGRectMake(0, 30, RQ_SCREEN_WIDTH, RQ_SCREEN_HEIGHT-60);
  46. }
  47. }
  48. #pragma mark - SystemMethods
  49. - (void)awakeFromNib {
  50. [super awakeFromNib];
  51. // Initialization code
  52. }
  53. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  54. [super setSelected:selected animated:animated];
  55. // Configure the view for the selected state
  56. }
  57. - (void)layoutSubviews {
  58. // _adView.frame = self.contentView.bounds;
  59. // _adView.frame = CGRectMake(0, 60, RQ_SCREEN_WIDTH, RQ_SCREEN_HEIGHT-60);
  60. }
  61. @end