NYLIVideoDetailSubPageCell.m 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // NYLIVideoDetailSubPageCell.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2025/2/11.
  6. // Copyright © 2025 JCZ. All rights reserved.
  7. //
  8. #import "NYLIVideoDetailSubPageCell.h"
  9. @interface NYLIVideoDetailSubPageCell ()
  10. @property (nonatomic, readwrite, strong) NYLIVideoDetailSubPageItemViewModel *viewModel;
  11. @property (nonatomic, readwrite, strong) RQVideoPermissionStateModel *videoPermissionStateModel;
  12. @property (weak, nonatomic) IBOutlet UIImageView *icon_imageview;
  13. @property (weak, nonatomic) IBOutlet UILabel *title_label;
  14. @property (weak, nonatomic) IBOutlet UIView *tag_view;
  15. @property (weak, nonatomic) IBOutlet QMUIButton *call_play_btn;
  16. @property (weak, nonatomic) IBOutlet UIButton *tag_bg_btn;
  17. @end
  18. @implementation NYLIVideoDetailSubPageCell
  19. #pragma mark - PublicMethods
  20. + (instancetype)cellWithTableView:(UITableView *)tableView {
  21. static NSString *ID = @"NYLIVideoDetailSubPageCell";
  22. NYLIVideoDetailSubPageCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  23. if (!cell) {
  24. cell = [self rq_viewFromXib];
  25. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  26. [cell.tag_bg_btn setBackgroundImage:[UIImage imageWithGradualChangingColor:^(QQGradualChangingColor *graColor) {
  27. graColor.fromColor = [UIColor qmui_colorWithHexString:@"#FFE7B8"];
  28. graColor.toColor = [UIColor qmui_colorWithHexString:@"##FDC67F"];
  29. graColor.type = QQGradualChangeTypeLeftToRight;
  30. } size:cell.tag_bg_btn.bounds.size cornerRadius:QQRadiusMake(5, 5, 5, 5)] forState:UIControlStateNormal];
  31. // [cell.call_play_btn addTarget:cell action:@selector(callPlaydoVideo:) forControlEvents:UIControlEventTouchUpInside];
  32. }
  33. return cell;
  34. }
  35. - (void)bindViewModel:(NYLIVideoDetailSubPageItemViewModel *)viewModel {
  36. @weakify(self)
  37. _viewModel = viewModel;
  38. [self.icon_imageview sd_setImageWithURL:[NSURL URLWithString:viewModel.videosItem.coverFileUrl] placeholderImage:randomPortrait()];
  39. RAC(self.title_label, text) = [[RACObserve(viewModel.videosItem, title) deliverOnMainThread] takeUntil:self.rac_prepareForReuseSignal];
  40. }
  41. ////播放通知
  42. //- (void)callPlaydoVideo:(UIButton *)btn {
  43. //
  44. //// VideosItem *videosItem = self.viewModel.videosItem;
  45. //// [RQNotificationCenter postNotificationName:RQPlayVideoUrlNotification object:@{
  46. //// RQPlayVideoItemKey : videosItem,
  47. //// RQPlayVideoItemArrKey : @[videosItem],
  48. //// }];
  49. //}
  50. #pragma mark - SystemMethods
  51. - (void)awakeFromNib {
  52. [super awakeFromNib];
  53. }
  54. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  55. [super setSelected:selected animated:animated];
  56. // Configure the view for the selected state
  57. }
  58. #pragma mark - LazyLoad
  59. - (RQVideoPermissionStateModel *)videoPermissionStateModel {
  60. if (!_videoPermissionStateModel) {
  61. _videoPermissionStateModel = [[RQVideoPermissionStateModel alloc] init];
  62. }
  63. return _videoPermissionStateModel;
  64. }
  65. @end