MOChooseTimeCell.m 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // MOChooseTimeCell.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/12/13.
  6. //
  7. #import "MOChooseTimeCell.h"
  8. @implementation MOChooseTimeCell
  9. - (instancetype)initWithFrame:(CGRect)frame
  10. {
  11. if (self = [super initWithFrame:frame])
  12. {
  13. self.backgroundColor = [UIColor clearColor];
  14. [self setupUI];
  15. }
  16. return self;
  17. }
  18. - (void)setupUI{
  19. [self.contentView addSubview:self.bgView];
  20. [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  21. make.edges.equalTo(self.contentView);
  22. }];
  23. [self.bgView addSubview:self.selectImg];
  24. [self.selectImg mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.equalTo(self.bgView).offset(5.0);
  26. make.width.height.equalTo(@18.0);
  27. make.centerY.equalTo(self.bgView.mas_centerY);
  28. }];
  29. [self.bgView addSubview:self.titleLab];
  30. [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.left.equalTo(self.selectImg.mas_right).offset(5.0);
  32. make.right.equalTo(self.bgView).offset(-5.0);
  33. make.top.bottom.equalTo(self.bgView);
  34. }];
  35. }
  36. - (void)setIsChoose:(BOOL)isChoose{
  37. _isChoose = isChoose;
  38. if(isChoose){
  39. [self.selectImg setImage:[UIImage imageNamed:@"icon_language_choose"]];
  40. self.bgView.layer.borderColor = [MOTools colorWithHexString:@"#FF9EEF" alpha:1.0].CGColor;
  41. self.bgView.backgroundColor = [UIColor whiteColor];
  42. }
  43. else{
  44. [self.selectImg setImage:[UIImage imageNamed:@"icon_language_no_choose"]];
  45. self.bgView.layer.borderColor = [MOTools colorWithHexString:@"#E0E0E0" alpha:1.0].CGColor;
  46. self.bgView.backgroundColor = [MOTools colorWithHexString:@"#E0E0E0" alpha:1.0];
  47. }
  48. }
  49. #pragma mark - Lazy
  50. - (UIView *)bgView{
  51. if(!_bgView){
  52. _bgView = [[UIView alloc] init];
  53. _bgView.backgroundColor = [UIColor whiteColor];
  54. _bgView.layer.cornerRadius = 35.0 / 2.0;
  55. _bgView.layer.masksToBounds = YES;
  56. _bgView.layer.borderWidth = 0.5;
  57. }
  58. return _bgView;
  59. }
  60. - (UIImageView *)selectImg{
  61. if (!_selectImg)
  62. {
  63. _selectImg = [[UIImageView alloc] init];
  64. _selectImg.clipsToBounds = YES;
  65. _selectImg.userInteractionEnabled = NO;
  66. [_selectImg setImage:[UIImage imageNamed:@"icon_language_choose"]];
  67. _selectImg.contentMode = UIViewContentModeScaleAspectFill;
  68. }
  69. return _selectImg;
  70. }
  71. - (UILabel *)titleLab{
  72. if (!_titleLab)
  73. {
  74. _titleLab = [[UILabel alloc] init];
  75. _titleLab.text = @"";
  76. _titleLab.font = [UIFont systemFontOfSize:14.0];
  77. _titleLab.textColor = [MOTools colorWithHexString:@"#3B383D" alpha:1.0];
  78. _titleLab.textAlignment = NSTextAlignmentLeft;
  79. _titleLab.numberOfLines = 0;
  80. }
  81. return _titleLab;
  82. }
  83. @end