IndexGoodBookCell.m 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // IndexGoodBookCell.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/9/18.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "IndexGoodBookCell.h"
  9. @implementation IndexGoodBookCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  15. [super setSelected:selected animated:animated];
  16. // Configure the view for the selected state
  17. }
  18. + (IndexGoodBookCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  19. static NSString *cellIdentifer = @"IndexGoodBookCell0";
  20. IndexGoodBookCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  21. if (cell == nil) {
  22. cell = [[[NSBundle mainBundle] loadNibNamed:@"IndexGoodBookCell" owner:nil options:nil] objectAtIndex:0];
  23. }
  24. return cell;
  25. }
  26. + (IndexGoodBookCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  27. static NSString *cellIdentifer = @"IndexGoodBookCell1";
  28. IndexGoodBookCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  29. if (cell == nil) {
  30. cell = [[[NSBundle mainBundle] loadNibNamed:@"IndexGoodBookCell" owner:nil options:nil] objectAtIndex:1];
  31. }
  32. return cell;
  33. }
  34. - (void)setDataWithModel:(HomeSubItemModel *)model searchText:(NSString *)text
  35. {
  36. [self.imgV sd_setImageWithURL:[NSURL URLWithString:model.ImageUrls] placeholderImage:IMG(@"img_placeHolder")];
  37. self.titleL.attributedText = [ZYCTool checkOfString:model.Title withSearchText:text withColor:UIColorHex(0xFF5252)];
  38. CGFloat height = [self.titleL sizeThatFits:CGSizeMake(SCREEN_WIDTH - 143, MAXFLOAT)].height;
  39. if (height > 30) {
  40. self.subtitleL.numberOfLines = 1;
  41. }else{
  42. self.subtitleL.numberOfLines = 2;
  43. }
  44. self.nameL.text = model.Author;
  45. self.subtitleL.text = model.Summary;
  46. }
  47. - (void)setDataWithModel:(BookRecommendModel *)model
  48. {
  49. [self.imgV sd_setImageWithURL:[NSURL URLWithString:model.ImageUrls] placeholderImage:IMG(@"img_placeHolder")];
  50. self.titleL.text = model.Title;
  51. CGFloat height = [self.titleL sizeThatFits:CGSizeMake(SCREEN_WIDTH - 143, MAXFLOAT)].height;
  52. if (height > 30) {
  53. self.subtitleL.numberOfLines = 1;
  54. }else{
  55. self.subtitleL.numberOfLines = 2;
  56. }
  57. self.nameL.text = model.Author;
  58. self.subtitleL.text = model.Summary;
  59. }
  60. @end