123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- //
- // XYRedPacketDetailGiftCell.m
- // Timi
- //
- // Created by gy on 2021/11/22.
- //
- #import "XYRedPacketDetailGiftCell.h"
- @interface XYRedPacketDetailGiftCell(){
-
- }
- @property (nonatomic, strong) UIView *contentView1;
- @property (nonatomic, strong) UIImageView *imgView;
- @property (nonatomic, strong) UILabel *nameLab;
- @property (nonatomic, strong) UILabel *priceLab;
- @end
- @implementation XYRedPacketDetailGiftCell
- - (void)reload:(YQLiveCoinGiftCoinModel *)info{
- [self contentView1];
- [self.imgView sd_setImageWithURL:UrlForString(info.image) placeholderImage:placeholderImage()];
- self.nameLab.text = info.name;
- self.priceLab.text = [NSString stringWithFormat:@"价值%d%@",info.addScoreValue,info.giftPriceTypeName];
- }
- #pragma mark — lazy
- - (UIView *)contentView1{
- if (_contentView1 == nil) {
- _contentView1 = [[UIView alloc] initWithFrame:CGRectZero];
- _contentView1.backgroundColor = [UIColor colorWithHexString:@"#D4A223" alpha:0.05];
- [self.contentView addSubview:_contentView1];
- [_contentView1 mas_makeConstraints:^(MASConstraintMaker *make) {;
- make.edges.equalTo(self.contentView);
- }];
- kViewRadius(_contentView1, 8);
- }
- return _contentView1;
- }
- - (UIImageView *)imgView{
- if (_imgView == nil) {
- _imgView = [[UIImageView alloc] init];
- _imgView.image = [UIImage imageNamed:@"icon-redpacket"];
- _imgView.contentMode = UIViewContentModeScaleAspectFill;
- _imgView.clipsToBounds = YES;
- [self.contentView addSubview:_imgView];
- [_imgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.contentView.mas_centerX).offset(0);
- make.top.equalTo(self.contentView.mas_top).offset(4);
- make.width.offset(56);
- make.height.offset(56);
- }];
- }
- return _imgView;
- }
- - (UILabel *)nameLab{
- if (_nameLab == nil) {
- _nameLab = [[UILabel alloc] init];
- _nameLab.text = @"";
- _nameLab.textAlignment = NSTextAlignmentCenter;
- _nameLab.textColor = [UIColor colorWithHexString:@"#303133" alpha:1];
- _nameLab.font = [UIFont fontWithName:kPFSCFont size:12];
- [_nameLab sizeToFit];
- [self.contentView addSubview:_nameLab];
- [_nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.contentView.mas_centerX).offset(0);
- make.top.equalTo(self.imgView.mas_bottom).offset(4);
- }];
- }
- return _nameLab;
- }
- - (UILabel *)priceLab{
- if (_priceLab == nil) {
- _priceLab = [[UILabel alloc] init];
- _priceLab.text = @"";
- _priceLab.textAlignment = NSTextAlignmentCenter;
- _priceLab.textColor = [UIColor colorWithHexString:@"#909399" alpha:1];
- _priceLab.font = [UIFont fontWithName:kPFSCFont size:8];
- [_priceLab sizeToFit];
- [self.contentView addSubview:_priceLab];
- [_priceLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.contentView.mas_centerX).offset(0);
- make.top.equalTo(self.nameLab.mas_bottom).offset(1);
- }];
- }
- return _priceLab;
- }
- @end
|