AuctionGoodsCell.m 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // AuctionGoodsCell.m
  3. // BuguLive
  4. //
  5. // Created by 王珂 on 16/10/11.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "AuctionGoodsCell.h"
  9. #import "ShopGoodsModel.h"
  10. @interface AuctionGoodsCell()
  11. {
  12. NetHttpsManager *_httpsManager;
  13. }
  14. @property (weak, nonatomic) IBOutlet UIImageView *goodsImageView;
  15. @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
  16. @property (weak, nonatomic) IBOutlet UILabel *desLabel;
  17. @property (weak, nonatomic) IBOutlet UIImageView *diamondsImgView;
  18. @property (weak, nonatomic) IBOutlet UILabel *priceLabel;
  19. @property (weak, nonatomic) IBOutlet UILabel *lineLabel;
  20. @property (weak, nonatomic) IBOutlet UIButton *toSetAuctionButton;
  21. @end
  22. @implementation AuctionGoodsCell
  23. + (instancetype)cellWithTableView:(UITableView *)tableView
  24. {
  25. static NSString * cellID = @"AuctionGoodsCell";
  26. AuctionGoodsCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID];
  27. if (cell== nil) {
  28. cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([AuctionGoodsCell class]) owner:nil options:nil] lastObject];;
  29. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  30. }
  31. return cell;
  32. }
  33. - (void)awakeFromNib
  34. {
  35. [super awakeFromNib];
  36. _goodsImageView.clipsToBounds = YES;
  37. _titleLabel.font = kAppMiddleTextFont;
  38. _titleLabel.textColor = kAppGrayColor1;
  39. _desLabel.textColor = kAppGrayColor3;
  40. _desLabel.hidden = YES;
  41. _desLabel.font = kAppSmallTextFont;
  42. _priceLabel.textColor = kAppGrayColor1;
  43. _priceLabel.font = kAppSmallTextFont;
  44. _toSetAuctionButton.layer.cornerRadius = 13;
  45. _toSetAuctionButton.layer.masksToBounds = YES;
  46. _toSetAuctionButton.backgroundColor = kAppMainColor;
  47. [_toSetAuctionButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
  48. [_toSetAuctionButton setTitle:ASLocalizedString(@"设为拍卖")forState:UIControlStateNormal];
  49. _toSetAuctionButton.titleLabel.font = kAppSmallTextFont;
  50. _lineLabel.backgroundColor = kAppSpaceColor;
  51. }
  52. - (void)setModel:(ShopGoodsModel *)model
  53. {
  54. _model = model;
  55. [_goodsImageView sd_setImageWithURL:[NSURL URLWithString:model.imgs[0]] placeholderImage:[UIImage imageNamed:@"DefaultImg"]];
  56. _titleLabel.text = model.name;
  57. if (model.descStr.length > 0)
  58. {
  59. _desLabel.hidden = NO;
  60. _desLabel.text = model.descStr;
  61. }
  62. else
  63. {
  64. _desLabel.hidden = YES;
  65. }
  66. _priceLabel.text = model.price;
  67. }
  68. //设为拍卖
  69. - (IBAction)clickButton:(id)sender
  70. {
  71. if (_delegate && [_delegate respondsToSelector:@selector(clickAuctionWithAuctionGoodsCell:)])
  72. {
  73. [_delegate clickAuctionWithAuctionGoodsCell: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