123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- //
- // YMWithdrawalAccountListCell.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/3/6.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMWithdrawalAccountListCell.h"
- #import "YMWithdrawalAccountListCellViewModel.h"
- @interface YMWithdrawalAccountListCell ()
- /// 提现账号列表VM
- @property (nonatomic, strong) YMWithdrawalAccountListCellViewModel *viewModel;
- /// 基础视图
- @property (nonatomic, strong) UIView *baseView;
- /// 提现账号持有人标题标签
- @property (nonatomic, strong) UILabel *withdrawalAccountHolderTitleLb;
- /// 提现账号持有人标题标签
- @property (nonatomic, strong) UILabel *withdrawalAccountHolderContentLb;
- /// 提现账号标题标签
- @property (nonatomic, strong) UILabel *withdrawalAccountTitleLb;
- /// 提现账号内容标签
- @property (nonatomic, strong) UILabel *withdrawalAccountContentLb;
- /// 编辑按钮
- @property (nonatomic, strong) UIButton *editBtn;
- @end
- @implementation YMWithdrawalAccountListCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (void)ym_setupViews{
- [self.contentView addSubview:self.baseView];
- [self.baseView addSubview:self.withdrawalAccountHolderTitleLb];
- [self.baseView addSubview:self.withdrawalAccountHolderContentLb];
- [self.baseView addSubview:self.withdrawalAccountTitleLb];
- [self.baseView addSubview:self.withdrawalAccountContentLb];
- [self.baseView addSubview:self.editBtn];
-
- [self setNeedsUpdateConstraints];
- [self updateConstraintsIfNeeded];
- }
- - (void)updateConstraints{
-
- [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.contentView).offset(adapt(10));
- make.left.equalTo(self.contentView).offset(adapt(10));
- make.right.equalTo(self.contentView).offset(adapt(-10));
- make.bottom.equalTo(self.contentView);
- }];
-
- [self.withdrawalAccountHolderTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(self.baseView.mas_centerY).offset(adapt(-5));
- make.left.equalTo(self.baseView).offset(adapt(12));
- }];
-
- [self.withdrawalAccountHolderContentLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.withdrawalAccountHolderTitleLb.mas_centerY);
- make.left.equalTo(self.withdrawalAccountHolderTitleLb.mas_right).offset(adapt(3));
- make.right.equalTo(self.editBtn.mas_left).offset(adapt(-10));
- }];
-
- [self.withdrawalAccountTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.baseView.mas_centerY).offset(adapt(5));
- make.left.equalTo(self.baseView).offset(adapt(12));
- }];
-
- [self.withdrawalAccountContentLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.withdrawalAccountTitleLb.mas_centerY);
- make.left.equalTo(self.withdrawalAccountTitleLb.mas_right).offset(adapt(3));
- make.right.equalTo(self.editBtn.mas_left).offset(adapt(-10));
- }];
-
- [self.editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.baseView.mas_centerY);
- make.right.equalTo(self.baseView).offset(adapt(-10));
- make.width.mas_equalTo(adapt(60));
- make.height.mas_equalTo(adapt(30));
-
- }];
- [super updateConstraints];
- }
- - (void)ym_bindViewModel:(YMWithdrawalAccountListCellViewModel *)viewModel{
- if (!viewModel) {
- return;
- }
-
- _viewModel = viewModel;
- self.withdrawalAccountHolderTitleLb.text = stringFormat(@"%@姓名:",self.viewModel.withdrawalAccountTypeName);
- self.withdrawalAccountHolderContentLb.text = self.viewModel.withdrawalAccountHolder;
- self.withdrawalAccountTitleLb.text = stringFormat(@"%@提现账号:",self.viewModel.withdrawalAccountTypeName);
- self.withdrawalAccountContentLb.text = self.viewModel.withdrawalAccount;
- self.editBtn.hidden = self.viewModel.isHideEditButton;
- }
- - (UIView *)baseView{
- if (!_baseView) {
- _baseView = [[UIView alloc]init];
- _baseView.backgroundColor = HexColorFromRGB(0xF6F6F6);
- _baseView.layer.cornerRadius = adapt(10);
- _baseView.layer.masksToBounds = YES;
- }
- return _baseView;
- }
- - (UILabel *)withdrawalAccountHolderTitleLb{
- if (!_withdrawalAccountHolderTitleLb) {
- _withdrawalAccountHolderTitleLb = [[UILabel alloc]init];
- _withdrawalAccountHolderTitleLb.font = LCFont(13);
- _withdrawalAccountHolderTitleLb.textColor = HexColorFromRGB(0x1B2739);
- _withdrawalAccountHolderTitleLb.textAlignment = NSTextAlignmentLeft;
- _withdrawalAccountHolderTitleLb.text = @"******";
- /**
- *抗拉伸 setContentHuggingPriority(值越高,越不容易拉伸)
- */
- [_withdrawalAccountHolderTitleLb setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
- /**
- *抗压缩 setContentCompressionResistancePriority(值越高,越不容易压缩)
- **/
- [_withdrawalAccountHolderTitleLb setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
- }
- return _withdrawalAccountHolderTitleLb;
- }
- - (UILabel *)withdrawalAccountHolderContentLb{
- if (!_withdrawalAccountHolderContentLb) {
- _withdrawalAccountHolderContentLb = [[UILabel alloc]init];
- _withdrawalAccountHolderContentLb.font = LCFont(13);
- _withdrawalAccountHolderContentLb.textColor = HexColorFromRGB(0x1B2739);
- _withdrawalAccountHolderContentLb.textAlignment = NSTextAlignmentLeft;
- _withdrawalAccountHolderContentLb.text = @"******";
- /**
- *抗拉伸 setContentHuggingPriority(值越高,越不容易拉伸)
- */
- [_withdrawalAccountHolderContentLb setContentHuggingPriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
- /**
- *抗压缩 setContentCompressionResistancePriority(值越高,越不容易压缩)
- **/
- [_withdrawalAccountHolderContentLb setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
- }
- return _withdrawalAccountHolderContentLb;
- }
- - (UILabel *)withdrawalAccountTitleLb{
- if (!_withdrawalAccountTitleLb) {
- _withdrawalAccountTitleLb = [[UILabel alloc]init];
- _withdrawalAccountTitleLb.font = LCFont(13);
- _withdrawalAccountTitleLb.textColor = HexColorFromRGB(0x1B2739);
- _withdrawalAccountTitleLb.textAlignment = NSTextAlignmentLeft;
- _withdrawalAccountTitleLb.text = @"******";
- /**
- *抗拉伸 setContentHuggingPriority(值越高,越不容易拉伸)
- */
- [_withdrawalAccountTitleLb setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
- /**
- *抗压缩 setContentCompressionResistancePriority(值越高,越不容易压缩)
- **/
- [_withdrawalAccountTitleLb setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
- }
- return _withdrawalAccountTitleLb;
- }
- - (UILabel *)withdrawalAccountContentLb{
- if (!_withdrawalAccountContentLb) {
- _withdrawalAccountContentLb = [[UILabel alloc]init];
- _withdrawalAccountContentLb.font = LCFont(13);
- _withdrawalAccountContentLb.textColor = HexColorFromRGB(0x1B2739);
- _withdrawalAccountContentLb.textAlignment = NSTextAlignmentLeft;
- _withdrawalAccountContentLb.text = @"******";
- /**
- *抗拉伸 setContentHuggingPriority(值越高,越不容易拉伸)
- */
- [_withdrawalAccountContentLb setContentHuggingPriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
- /**
- *抗压缩 setContentCompressionResistancePriority(值越高,越不容易压缩)
- **/
- [_withdrawalAccountContentLb setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
- }
- return _withdrawalAccountContentLb;
- }
- - (UIButton *)editBtn{
- if (!_editBtn) {
- _editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _editBtn.titleLabel.font = LCFont(13);
- [_editBtn setTitleColor:MAINGRIDTitleC forState:UIControlStateNormal];
- [_editBtn ym_setGradientBackgroundWithColors:kMainGradColors locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
- [_editBtn setTitle:@"编辑" forState:UIControlStateNormal];
- _editBtn.layer.cornerRadius = adapt(8);
- _editBtn.layer.masksToBounds = YES;
- WS(weakSelf)
- [[[_editBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- [weakSelf.viewModel gotoBindWithdrawalAccount];
- }];
- }
- return _editBtn;
- }
- @end
|