ASCheckoutPaymentCell.m 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //
  2. // ASCheckoutPaymentCell.m
  3. // Asteria
  4. //
  5. // Created by xingyu on 2024/5/8.
  6. //
  7. #import "ASCheckoutPaymentCell.h"
  8. @interface ASCheckoutPaymentCell()
  9. @property (nonatomic, strong) UIView *bgView;
  10. @property (nonatomic, strong) UILabel *titleLab;
  11. @property (nonatomic, strong) UIImageView *selectImageView;
  12. @end
  13. @implementation ASCheckoutPaymentCell
  14. - (void)awakeFromNib {
  15. [super awakeFromNib];
  16. // Initialization code
  17. }
  18. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  19. [super setSelected:selected animated:animated];
  20. // Configure the view for the selected state
  21. }
  22. - (void)setupSubviewS{ //height 200
  23. self.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
  24. [self.contentView addSubview:self.bgView];
  25. [self.bgView addSubview:self.titleLab];
  26. [self.bgView addSubview:self.selectImageView];
  27. [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.left.top.mas_equalTo(10);
  29. make.right.mas_equalTo(-10);
  30. make.bottom.mas_equalTo(0);
  31. }];
  32. [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.left.mas_equalTo(10);
  34. make.top.mas_equalTo(20);
  35. make.height.mas_equalTo(20);
  36. make.right.mas_equalTo(-100);
  37. make.bottom.mas_equalTo(-20);
  38. }];
  39. [self.selectImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.centerY.equalTo(self.bgView);
  41. make.width.height.mas_equalTo(24);
  42. make.right.mas_equalTo(-12);
  43. }];
  44. }
  45. - (void)configData:(id)Data{
  46. ASCheckoutPaymentModel *model = (ASCheckoutPaymentModel *)Data;
  47. self.titleLab.text = model.title;
  48. if (model.isSelect) {
  49. _selectImageView.image = [UIImage imageNamed:@"base_radio_select"];
  50. } else {
  51. _selectImageView.image = [UIImage imageNamed:@"base_radio_unselect"];
  52. }
  53. }
  54. -(UIView *)bgView{
  55. if(!_bgView){
  56. _bgView = [[UIView alloc]init];
  57. _bgView.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
  58. _bgView.layer.cornerRadius = 4;
  59. _bgView.clipsToBounds = YES;
  60. }
  61. return _bgView;
  62. }
  63. -(UILabel *)titleLab{
  64. if(!_titleLab){
  65. _titleLab = [[UILabel alloc]init];
  66. _titleLab.text = @"";
  67. _titleLab.textColor = [UIColor colorWithHexString:@"#000000"];
  68. _titleLab.adjustsFontSizeToFitWidth = YES;
  69. _titleLab.font = [UIFont fontWithName:Rob_Bold size:16];
  70. }
  71. return _titleLab;
  72. }
  73. - (UIImageView *)selectImageView{
  74. if(!_selectImageView){
  75. _selectImageView = [[UIImageView alloc] init];
  76. _selectImageView.image = [UIImage imageNamed:@"base_radio_unselect"];
  77. }
  78. return _selectImageView;
  79. }
  80. @end