123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- //
- // ASHomeNewInProductItemView.m
- // Asteria
- //
- // Created by iOS on 2023/6/9.
- //
- #import "ASHomeNewInProductItemView.h"
- @implementation ASHomeNewInProductItemView
- - (void)setModel:(ASProductBaseModel *)model {
- [super setModel:model];
- self.nowPriceLb.hidden = true;
- self.oldPriceLb.hidden = true;
- self.priceLb.text = model.nowPrice;
- }
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- [self loadSubV];
- }
- return self;
- }
- - (void)loadSubV {
-
- [self.addCartBt setImage:[UIImage imageNamed:@"home_newin_addCart"] forState:UIControlStateNormal];
- [self addSubview:self.priceBgV];
- [self addSubview:self.priceLb];
-
- self.oldPriceLb.hidden = true;
- self.nowPriceLb.hidden = true;
- self.hotLb.hidden = true;
- [self.priceBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.leading.equalTo(self.titleLb);
- make.height.equalTo(@16);
- make.bottom.equalTo(self.mas_bottom).offset(-20);
- make.top.greaterThanOrEqualTo(self.titleLb.mas_bottom).offset(22);
- }];
- [self.priceLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.equalTo(@29);
- make.leading.equalTo(self.priceBgV).offset(25);
- make.centerX.equalTo(self.priceBgV);
- make.bottom.equalTo(self.priceBgV.mas_bottom).offset(-4.5);
- }];
-
- [self.addCartBt mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.bottom.trailing.equalTo(self).offset(-20);
- make.width.height.equalTo(@36);
- }];
-
- }
- - (UIImageView *)priceBgV {
- if (!_priceBgV) {
- UIImageView *imgV = [[UIImageView alloc] init];
- imgV.image = [UIImage imageNamed:@"home_newin_priceBg"];
- imgV.contentMode = UIViewContentModeScaleToFill;
- _priceBgV = imgV;
- }
- return _priceBgV;
- }
- - (UILabel *)priceLb {
- if (!_priceLb) {
- UILabel *lb = [[UILabel alloc] init];
- lb.font = [UIFont fontWithName:Rob_Bold size:24];
- lb.textColor = [UIColor blackColor];
- lb.textAlignment = NSTextAlignmentCenter;
- _priceLb = lb;
- }
- return _priceLb;
- }
- @end
|