12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- //
- // YOUPAILZGameListCell.m
- // VQU
- //
- // Created by CY on 2021/4/26.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZGameListCell.h"
- #import "YOUPAILZGameModel.h"
- @interface YOUPAILZGameListCell ()
- @property (nonatomic, weak) UIImageView *youpaipimgV;
- @property (nonatomic, weak) UILabel *youpaipnameL;
- @property (nonatomic, weak) UIButton *youpaipsetterPriceBtn;
- @property (nonatomic, strong) YOUPAILZGameModel *youpaipmodel;
- @end
- @implementation YOUPAILZGameListCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.backgroundColor = [UIColor clearColor];
-
- [self youpaifsetupUI];
- }
- return self;
- }
- - (void)youpaifsetupUI{
-
- UIView *bgV = [[UIView alloc] init];
- bgV.layer.cornerRadius = ScaleSize(8.0f);
- bgV.clipsToBounds = YES;
- bgV.backgroundColor = [UIColor whiteColor];
- [self.contentView addSubview:bgV];
- [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(0.0f);
- make.left.offset(ScaleSize(16.0f));
- make.right.offset(-ScaleSize(16.0f));
- make.bottom.offset(-20.0f);
- }];
-
- UIImageView *imgV = [[UIImageView alloc] init];
- imgV.contentMode = UIViewContentModeScaleAspectFill;
- [bgV addSubview:imgV];
- self.youpaipimgV = imgV;
- [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.right.offset(0.0f);
- make.height.offset(ScaleSize(193.0f));
- }];
-
- UILabel *nameL = [[UILabel alloc] init];
- nameL.textAlignment = NSTextAlignmentCenter;
- nameL.font = LCFont17;
- nameL.textColor = HexColorFromRGB(0x333333);
- [bgV addSubview:nameL];
- self.youpaipnameL = nameL;
- [nameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(imgV.mas_bottom).offset(0.0f);
- make.left.bottom.right.offset(0.0f);
- }];
-
- UIButton *setterPriceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [setterPriceBtn setTitle:@"设置价格" forState:UIControlStateNormal];
- [setterPriceBtn setTitleColor:ZYPinkColor forState:UIControlStateNormal];
- setterPriceBtn.titleLabel.font = LCFont15;
- // [setterPriceBtn setImage:[UIImage imageNamed:@"vqu_images_game_setter_price"] forState:UIControlStateNormal];
- [setterPriceBtn addTarget:self action:@selector(youpaifsetterPriceBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [bgV addSubview:setterPriceBtn];
- self.youpaipsetterPriceBtn = setterPriceBtn;
- [setterPriceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(imgV.mas_bottom).offset(0.0f);
- make.right.offset(-10.0f);
- make.bottom.offset(0.0f);
- // make.width.offset(49.0f);
- }];
- setterPriceBtn.hidden = YES;
- }
- - (void)youpaifreloadWithModel:(YOUPAILZGameModel *)model{
- self.youpaipmodel = model;
- [self.youpaipimgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipcover]];
- self.youpaipnameL.text = model.youpaipname;
- self.youpaipsetterPriceBtn.hidden = model.youpaipprice == -1;
- }
- - (void)youpaifsetterPriceBtnClick{
- if (self.setterPriceBtnClickBlock != nil) {
- self.setterPriceBtnClickBlock(self.youpaipmodel);
- }
- }
- @end
|