You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.7 KiB

//
// PayTableViewCell.m
// tongxin
//
// Created by ecell on 2023/3/27.
// Copyright © 2023 xTT. All rights reserved.
//
#import "PayTableViewCell.h"
@interface PayTableViewCell ()
@property (nonatomic ,weak) UIImageView *payIcon;
@property (nonatomic ,weak) UILabel *titleLabel;
@property (nonatomic ,weak) UIButton *selectBtn;
@end
@implementation PayTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = UIColor.clearColor;
[self subCellView];
}
return self;
}
- (void)setPaymodel:(PayModel *)paymodel
{
_paymodel = paymodel;
[self.payIcon sd_setImageWithURL:[NSURL URLWithString:paymodel.payIcon] placeholderImage:[UIImage imageNamed:@""]];
self.titleLabel.text = paymodel.payName;
}
- (void)subCellView
{
UIImageView *payIcon = [UIImageView new];
self.payIcon = payIcon;
[self.contentView addSubview:payIcon];
[payIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contentView);
make.left.equalTo(self.contentView).offset(15);
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
UILabel *titleLabel = [UILabel new];
titleLabel.textColor = UIColor.blackColor;
self.titleLabel = titleLabel;
titleLabel.font = Font_(15);
[self.contentView addSubview:titleLabel];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contentView);
make.left.equalTo(payIcon.mas_right).offset(10);
}];
UIButton *selectBtn = [[UIButton alloc] init];
self.selectBtn = selectBtn;
[selectBtn setImage:ImageName_(@"icon_selectImg_No") forState:UIControlStateNormal];
[self.contentView addSubview:selectBtn];
[selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).inset(15);
make.centerY.equalTo(self.contentView);
make.size.mas_equalTo(selectBtn.currentImage.size);
}];
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
UIImage *selectBtnImage = selected ? [UIImage imageNamed:@"icon_selectImg_Yes"] : [UIImage imageNamed:@"icon_selectImg_No"];
[self.selectBtn setImage:selectBtnImage forState:UIControlStateNormal];
if (selected)
{
self.selectBtn.selected = YES;
}else
{
self.selectBtn.selected = NO;
}
}
@end