XYNewWithdrawAmountItemCollectionViewCell.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // XYNewWithdrawAmountItemCollectionViewCell.m
  3. // Starbuds
  4. //
  5. // Created by 翟玉磊 on 2020/11/24.
  6. // Copyright © 2020 翟玉磊. All rights reserved.
  7. //
  8. #import "XYNewWithdrawAmountItemCollectionViewCell.h"
  9. #import "XYNewWithdrawAmountItemModel.h"
  10. @interface XYNewWithdrawAmountItemCollectionViewCell ()
  11. @property (nonatomic, strong) UILabel *contentLabel;
  12. @property (nonatomic, strong) UIImageView *selectedImageView;
  13. @end
  14. @implementation XYNewWithdrawAmountItemCollectionViewCell
  15. - (void)configureModel:(XYNewWithdrawAmountItemModel *)model {
  16. self.contentLabel.text = model.amount;
  17. if (model.selected) {
  18. [self.contentLabel addViewBorder:Color_TextRed redian:4];
  19. }else {
  20. [self.contentLabel addViewBorder:Color_line redian:4];
  21. }
  22. self.selectedImageView.hidden = !model.selected;
  23. }
  24. - (instancetype)initWithFrame:(CGRect)frame
  25. {
  26. self = [super initWithFrame:frame];
  27. if (self) {
  28. [self setupUI];
  29. }
  30. return self;
  31. }
  32. - (void)setupUI {
  33. [self.contentView addSubview:self.contentLabel];
  34. [self.contentView addSubview:self.selectedImageView];
  35. [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  36. make.edges.equalTo(self.contentView);
  37. }];
  38. [self.selectedImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.right.bottom.equalTo(self.contentLabel);
  40. make.width.height.equalTo(@18.0f);
  41. }];
  42. [self.contentLabel addViewBorder:Color_line redian:4];
  43. }
  44. #pragma mark — Getter
  45. - (UILabel *)contentLabel {
  46. if (!_contentLabel) {
  47. _contentLabel = [UILabel createLabelTextColor:Color_Nakaguro fount:Font(14)];
  48. _contentLabel.textAlignment = NSTextAlignmentCenter;
  49. }
  50. return _contentLabel;
  51. }
  52. - (UIImageView *)selectedImageView {
  53. if (!_selectedImageView) {
  54. _selectedImageView = [UIImageView new];
  55. _selectedImageView.image = ImageNamed(@"icon_wallet_amount_select");
  56. }
  57. return _selectedImageView;
  58. }
  59. @end