HomeMusicCell.m 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // HomeMusicCell.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/5/15.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "HomeMusicCell.h"
  9. #import "NSDate+Extension.h"
  10. @implementation HomeMusicCell
  11. - (void)awakeFromNib {
  12. [super awakeFromNib];
  13. // Initialization code
  14. }
  15. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  16. [super setSelected:selected animated:animated];
  17. // Configure the view for the selected state
  18. }
  19. + (HomeMusicCell *)configCell:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  20. static NSString *cellIdentifer = @"HomeMusicCell";
  21. HomeMusicCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  22. if (cell == nil) {
  23. cell = [[[NSBundle mainBundle] loadNibNamed:@"HomeMusicCell" owner:nil options:nil] objectAtIndex:0];
  24. }
  25. return cell;
  26. }
  27. - (void)setDataWithModel:(HomeSubItemModel *)model
  28. {
  29. [self.imagV sd_setImageWithURL:[NSURL URLWithString:model.ImageUrls] placeholderImage:IMG(@"img_placeHolder")];
  30. self.titleL.text = model.Title;
  31. self.subTitleL.text = @"";
  32. self.soundContant.constant = 0.f;
  33. self.countL.text = [NSString stringWithFormat:@"%ld",model.ReadCount];
  34. // self.timeL.text = model.Duration;
  35. }
  36. - (void)setDataWithModel:(HomeSubItemModel *)model searchText:(NSString *)text
  37. {
  38. [self.imagV sd_setImageWithURL:[NSURL URLWithString:model.ImageUrls] placeholderImage:IMG(@"img_placeHolder")];
  39. self.titleL.attributedText = [ZYCTool checkOfString:model.Title withSearchText:text withColor:UIColorHex(0xFF5252)];
  40. self.subTitleL.text = @"";
  41. self.titleL.numberOfLines = 1;
  42. self.soundContant.constant = 0.f;
  43. self.countL.text = [NSString stringWithFormat:@"%ld",model.ReadCount];
  44. self.timeL.text = model.Duration;
  45. self.DateL.text = [NSDate getMonthAndDayWihtDate:model.CreatedDate];
  46. }
  47. @end