LookHistoryCell.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // LookHistoryCell.m
  3. // yunbaolive
  4. //
  5. // Created by ybRRR on 2020/2/5.
  6. // Copyright © 2020 cat. All rights reserved.
  7. //
  8. #import "LookHistoryCell.h"
  9. @implementation LookHistoryCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. [self.selBtn setImage:[UIImage imageNamed:@"记录选中"] forState:UIControlStateSelected];
  13. [self.selBtn setImage:[UIImage imageNamed:@"记录未选"] forState:UIControlStateNormal];
  14. // Initialization code
  15. }
  16. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  17. [super setSelected:selected animated:animated];
  18. // for (UIView *subview in self.subviews) {
  19. // if ([subview isKindOfClass:NSClassFromString(@"UITableViewCellEditControl")]) {
  20. // UIControl *control = (UIControl *)subview;
  21. // [control setSelected:YES];
  22. // }
  23. // }
  24. }
  25. +(LookHistoryCell*)cellWithTab:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath{
  26. LookHistoryCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LookHistoryCell"];
  27. if (!cell) {
  28. cell = [[[NSBundle mainBundle]loadNibNamed:@"LookHistoryCell" owner:nil options:nil]objectAtIndex:0];
  29. }
  30. return cell;
  31. }
  32. -(void)setModel:(LookHistoryModel *)model
  33. {
  34. _model = model;
  35. self.selBtn.selected = _model.isSelected;
  36. [self.headImg sd_setImageWithURL:[NSURL URLWithString:model.goods_thumb]];
  37. self.nameLb.text = model.goods_name;
  38. if ([model.type isEqual:@"1"]) {
  39. self.original_priceLb.hidden = NO;
  40. self.lineLb.hidden = NO;
  41. self.priceLb.text =model.goods_price;
  42. self.original_priceLb.text = model.original_price;
  43. }else{
  44. self.priceLb.text= model.goods_price;
  45. }
  46. }
  47. @end