天天省钱快报

KBBuyLimitGoodCell.m 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // KBBuyLimitGoodCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/7/9.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBBuyLimitGoodCell.h"
  9. #import "KBBuyLimitGoodView.h"
  10. @interface KBBuyLimitGoodCell ()
  11. @property (nonatomic, strong) KBBuyLimitGoodView *limitGoodView;
  12. @end
  13. @implementation KBBuyLimitGoodCell
  14. - (void)awakeFromNib {
  15. [super awakeFromNib];
  16. // Initialization code
  17. }
  18. + (instancetype)cellWithTableView:(UITableView *)tableView {
  19. static NSString *cellID = nil;
  20. cellID = NSStringFromClass([self class]);
  21. KBBuyLimitGoodCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
  22. if (!cell) {
  23. cell = [[KBBuyLimitGoodCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
  24. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  25. }
  26. return cell;
  27. }
  28. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  29. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  30. if (self) {
  31. [self initSubViews];
  32. }
  33. return self;
  34. }
  35. - (void)initSubViews {
  36. [self.contentView addSubview:self.limitGoodView];
  37. [self.limitGoodView mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.left.mas_equalTo(25);
  39. make.right.mas_equalTo(-25);
  40. make.top.mas_equalTo(15);
  41. make.height.mas_equalTo(94);
  42. }];
  43. }
  44. - (void)setModel:(KBBuyLimitGoodModel *)model {
  45. _model = model;
  46. self.limitGoodView.model = model;
  47. }
  48. - (void)setCanBuy:(BOOL)canBuy {
  49. _canBuy = canBuy;
  50. self.limitGoodView.buyButton.enabled = canBuy;
  51. UIColor *color = canBuy?[UIColor homeRedColor]:[UIColor lightGrayColor];
  52. self.limitGoodView.buyButton.backgroundColor = color;
  53. }
  54. - (KBBuyLimitGoodView *)limitGoodView {
  55. if (!_limitGoodView) {
  56. _limitGoodView = [[KBBuyLimitGoodView alloc] init];
  57. }
  58. return _limitGoodView;
  59. }
  60. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  61. [super setSelected:selected animated:animated];
  62. // Configure the view for the selected state
  63. }
  64. @end