89 lines
2.5 KiB
Objective-C
89 lines
2.5 KiB
Objective-C
//
|
|
// XPLoginAreaTableViewCell.m
|
|
// YuMi
|
|
//
|
|
// Created by YuMi on 2023/6/25.
|
|
//
|
|
|
|
#import "XPLoginAreaTableViewCell.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
///Tool
|
|
#import "DJDKMIMOMColor.h"
|
|
#import "LoginAreaModel.h"
|
|
@interface XPLoginAreaTableViewCell()
|
|
@property (nonatomic,strong) UILabel *areaVeiw;
|
|
@property (nonatomic,strong) UILabel *codeView;
|
|
@property(nonatomic,strong) UIButton *clickBtn;
|
|
@end
|
|
@implementation XPLoginAreaTableViewCell
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
self.backgroundColor = [UIColor whiteColor];
|
|
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
[self.contentView addSubview:self.areaVeiw];
|
|
[self.contentView addSubview:self.codeView];
|
|
[self.contentView addSubview:self.clickBtn];
|
|
}
|
|
- (void)initSubViewConstraints {
|
|
[self.areaVeiw mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(kGetScaleWidth(15));
|
|
make.centerY.equalTo(self.contentView);
|
|
}];
|
|
[self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.mas_equalTo(-kGetScaleWidth(15));
|
|
make.centerY.equalTo(self.contentView);
|
|
}];
|
|
[self.clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.left.bottom.equalTo(self.contentView);
|
|
make.right.mas_equalTo(-kGetScaleWidth(20));
|
|
}];
|
|
}
|
|
-(void)didClickBtnAction{
|
|
if(self.delegate && [self.delegate respondsToSelector:@selector(didSelectModel:)]){
|
|
[self.delegate didSelectModel:self.areaModel];
|
|
}
|
|
}
|
|
- (void)setAreaModel:(LoginAreaModel *)areaModel{
|
|
_areaModel = areaModel;
|
|
_areaVeiw.text = _areaModel.name;
|
|
_codeView.text = _areaModel.code;
|
|
|
|
}
|
|
#pragma mark - 懒加载
|
|
|
|
- (UILabel *)areaVeiw {
|
|
if (!_areaVeiw) {
|
|
_areaVeiw = [[UILabel alloc] init];
|
|
_areaVeiw.font = [UIFont systemFontOfSize:14];
|
|
_areaVeiw.textColor = [DJDKMIMOMColor colorWithHexString:@"#1F1A4E"];
|
|
}
|
|
return _areaVeiw;
|
|
}
|
|
|
|
|
|
- (UILabel *)codeView {
|
|
if (!_codeView) {
|
|
_codeView = [[UILabel alloc] init];
|
|
_codeView.font = [UIFont systemFontOfSize:14];
|
|
_codeView.textColor = [DJDKMIMOMColor colorWithHexString:@"#1F1A4E"];
|
|
}
|
|
return _codeView;
|
|
}
|
|
- (UIButton *)clickBtn{
|
|
if(!_clickBtn){
|
|
_clickBtn = [UIButton new];
|
|
[_clickBtn addTarget:self action:@selector(didClickBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _clickBtn;
|
|
}
|
|
@end
|