ShopListTableViewCell.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // ShopListTableViewCell.m
  3. // BuguLive
  4. //
  5. // Created by yy on 16/9/21.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "ShopListTableViewCell.h"
  9. #import "ShopListModel.h"
  10. @interface ShopListTableViewCell()
  11. {
  12. NetHttpsManager *_httpsManager;
  13. }
  14. @property (weak, nonatomic) IBOutlet UIImageView *goodsView;
  15. @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
  16. @property (weak, nonatomic) IBOutlet UILabel *desLabel;//商品详情描述
  17. @property (weak, nonatomic) IBOutlet UILabel *priceLabel;
  18. @property (weak, nonatomic) IBOutlet UIButton *toEditButton;
  19. @property (weak, nonatomic) IBOutlet UILabel *lineLabel;
  20. @end
  21. @implementation ShopListTableViewCell
  22. + (instancetype)cellWithTableView:(UITableView *)tableView
  23. {
  24. static NSString *ID = @"ShopListTableViewCell";
  25. ShopListTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:ID];
  26. if (cell== nil) {
  27. cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([ShopListTableViewCell class]) owner:nil options:nil] lastObject];;
  28. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  29. }
  30. return cell;
  31. }
  32. - (void)awakeFromNib
  33. {
  34. [super awakeFromNib];
  35. _goodsView.clipsToBounds = YES;
  36. _titleLabel.font = kAppMiddleTextFont;
  37. _titleLabel.textColor = kAppGrayColor1;
  38. _desLabel.textColor = kAppGrayColor3;
  39. _desLabel.hidden = YES;
  40. _desLabel.font = kAppSmallTextFont;
  41. _priceLabel.textColor = kAppGrayColor1;
  42. _priceLabel.font = kAppSmallTextFont;
  43. _toEditButton.layer.cornerRadius = 13;
  44. _toEditButton.layer.masksToBounds = YES;
  45. _toEditButton.backgroundColor = kAppMainColor;
  46. [_toEditButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
  47. [_toEditButton setTitle:ASLocalizedString(@"编辑")forState:UIControlStateNormal];
  48. _toEditButton.titleLabel.font = kAppSmallTextFont;
  49. _lineLabel.backgroundColor = kAppSpaceColor;
  50. }
  51. - (void)setModel:(ShopListModel *)model
  52. {
  53. _model = model;
  54. if (model.imgs.count > 0) {
  55. [_goodsView sd_setImageWithURL:[NSURL URLWithString:model.imgs[0]] placeholderImage:[UIImage imageNamed:@"DefaultImg"]];
  56. }
  57. _titleLabel.text = model.name;
  58. _priceLabel.text =[NSString stringWithFormat:@"¥ %@",model.price];
  59. // if (model.showDes) {
  60. // _desLabel.hidden = NO;
  61. // _desLabel.text = model.descrStr;
  62. // }
  63. // else
  64. // {
  65. // _desLabel.hidden = YES;
  66. // }
  67. _desLabel.hidden = NO;
  68. _desLabel.text = model.descrStr;
  69. }
  70. - (IBAction)clickButton:(id)sender
  71. {
  72. if (_delegate && [_delegate respondsToSelector:@selector(enterEditWithShopListTableViewCell:)]) {
  73. [_delegate enterEditWithShopListTableViewCell:self];
  74. }
  75. }
  76. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  77. [super setSelected:selected animated:animated];
  78. // Configure the view for the selected state
  79. }
  80. @end