123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- //
- // DRBuyLimitGoodCell.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/7/9.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRBuyLimitGoodCell.h"
- #import "DRBuyLimitGoodView.h"
- @interface DRBuyLimitGoodCell ()
- @property (nonatomic, strong) DRBuyLimitGoodView *limitGoodView;
- @end
- @implementation DRBuyLimitGoodCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- + (instancetype)cellWithTableView:(UITableView *)tableView {
- static NSString *cellID = nil;
- cellID = NSStringFromClass([self class]);
- DRBuyLimitGoodCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
- if (!cell) {
- cell = [[DRBuyLimitGoodCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return cell;
-
- }
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- [self initSubViews];
- }
- return self;
- }
- - (void)initSubViews {
- [self.contentView addSubview:self.limitGoodView];
-
- [self.limitGoodView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(25);
- make.right.mas_equalTo(-25);
- make.top.mas_equalTo(15);
- make.height.mas_equalTo(94);
- }];
- }
- - (void)setModel:(DRBuyLimitGoodModel *)model {
- _model = model;
- self.limitGoodView.model = model;
- }
- - (void)setCanBuy:(BOOL)canBuy {
- _canBuy = canBuy;
- self.limitGoodView.buyButton.enabled = canBuy;
- UIColor *color = canBuy?[UIColor homeRedColor]:[UIColor lightGrayColor];
- self.limitGoodView.buyButton.backgroundColor = color;
- }
- - (DRBuyLimitGoodView *)limitGoodView {
- if (!_limitGoodView) {
- _limitGoodView = [[DRBuyLimitGoodView alloc] init];
- }
- return _limitGoodView;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|