// // RQDspVideoDetailCell.m // JSJP // // Created by RONGQING on 2022/1/20. // #import "RQDspVideoDetailCell.h" @interface RQDspVideoDetailCell () @property (nonatomic, readwrite, strong) RQDspVideoDetailItemViewModel *viewModel; @property (weak, nonatomic) IBOutlet UIImageView *coverImageView; @end @implementation RQDspVideoDetailCell #pragma mark - PublicMethods + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @"RQDspVideoDetailCell"; RQDspVideoDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (!cell) { cell = [self rq_viewFromXib]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.coverImageView.userInteractionEnabled = YES; cell.coverImageView.tag = 10086; } return cell; } - (void)bindViewModel:(RQDspVideoDetailItemViewModel *)viewModel { _viewModel = viewModel; if (RQStringIsNotEmpty(viewModel.videosItem.coverFileUrl)) { if (RQObjectIsNil(viewModel.videosItem.adView)) { [_coverImageView yy_setImageWithURL:[NSURL URLWithString:viewModel.videosItem.coverFileUrl] placeholder:RQWebVideoImagePlaceholder() options:RQWebImageOptionAutomatic completion:nil]; } else { self.adView = viewModel.videosItem.adView; } } } - (void)setAdView:(UIView *)adView { if(_adView == adView) return; if(_adView.superview == self) [_adView removeFromSuperview]; _adView = adView; [self.contentView addSubview:adView]; if(RQ_IS_IPHONE_IPhoneX_All){ adView.frame = CGRectMake(0, 60, RQ_SCREEN_WIDTH, RQ_SCREEN_HEIGHT-120); }else{ adView.frame = CGRectMake(0, 30, RQ_SCREEN_WIDTH, RQ_SCREEN_HEIGHT-60); } } #pragma mark - SystemMethods - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (void)layoutSubviews { // _adView.frame = self.contentView.bounds; // _adView.frame = CGRectMake(0, 60, RQ_SCREEN_WIDTH, RQ_SCREEN_HEIGHT-60); } @end