123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //
- // RQVideoDetailSubPageCell.m
- // SDJK
- //
- // Created by 张嵘 on 2021/11/5.
- //
- #import "RQVideoDetailSubPageCell.h"
- @interface RQVideoDetailSubPageCell ()
- @property (nonatomic, readwrite, strong) RQVideoDetailSubPageItemViewModel *viewModel;
- @property (weak, nonatomic) IBOutlet UIView *topLine;
- @property (weak, nonatomic) IBOutlet UILabel *indexLabel;
- @property (weak, nonatomic) IBOutlet UIView *bottomLine;
- @property (weak, nonatomic) IBOutlet UIButton *stateBtn;
- @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
- @property (weak, nonatomic) IBOutlet UILabel *subTitleLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *videoImageView;
- @property (weak, nonatomic) IBOutlet UIButton *isLearningBtn;
- @end
- @implementation RQVideoDetailSubPageCell
- #pragma mark - PublicMethods
- + (instancetype)cellWithTableView:(UITableView *)tableView {
- static NSString *ID = @"RQVideoDetailSubPageCell";
- RQVideoDetailSubPageCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
- if (!cell) {
- cell = [self rq_viewFromXib];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- [cell.stateBtn borderColor:RQ_MAIN_COLOR width:1 cornorRadius:8];
- [cell.stateBtn setTitleColor:RQ_MAIN_COLOR forState:UIControlStateNormal];
- cell.indexLabel.textColor = RQ_MAIN_COLOR;
- }
- return cell;
- }
- - (void)bindViewModel:(RQVideoDetailSubPageItemViewModel *)viewModel {
- _viewModel = viewModel;
- _indexLabel.text = [NSString stringWithFormat:@"%ld",viewModel.videosItem.index];
- _topLine.hidden = viewModel.videosItem.index == 1;
- _bottomLine.hidden = viewModel.videosItem.totalNum == viewModel.videosItem.index;
- _titleLabel.text = viewModel.videosItem.title;
- _subTitleLabel.text = viewModel.videosItem.videoDescribe? : @"";
- [_videoImageView yy_setImageWithURL:[NSURL URLWithString:viewModel.videosItem.coverFileUrl] placeholder:RQWebVideoImagePlaceholder()];
-
- [[RACObserve(viewModel.videosItem, isPlaying) takeUntil:self.rac_prepareForReuseSignal] subscribeNext:^(id _Nullable x) {
- if (viewModel.videosItem.isPlaying) {
- _isLearningBtn.hidden = NO;
- _titleLabel.textColor = RQ_MAIN_COLOR;
- _subTitleLabel.textColor = RQ_MAIN_COLOR;
- } else {
- _isLearningBtn.hidden = YES;
- _titleLabel.textColor = RQ_MAIN_TEXT_COLOR_1;
- _subTitleLabel.textColor = RQ_MAIN_TEXT_COLOR_3;
- }
- }];
- }
- #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
- }
- @end
|