MOGuildSureCell.m 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // MOGuildSureCell.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2025/10/16.
  6. //
  7. #import "MOGuildSureCell.h"
  8. @implementation MOGuildSureCell
  9. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  10. {
  11. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
  12. {
  13. //Cell 去除选中效果
  14. self.selectionStyle = UITableViewCellSelectionStyleNone;
  15. self.backgroundColor = [UIColor clearColor];
  16. [self.contentView addSubview:self.applyBtn];
  17. [self.applyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  18. make.leading.mas_equalTo(@32.0);
  19. make.trailing.mas_equalTo(@-32.0);
  20. make.height.mas_equalTo(@48.0);
  21. make.centerY.equalTo(self.contentView);
  22. }];
  23. }
  24. return self;
  25. }
  26. - (void)awakeFromNib {
  27. [super awakeFromNib];
  28. // Initialization code
  29. }
  30. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  31. [super setSelected:selected animated:animated];
  32. // Configure the view for the selected state
  33. }
  34. - (void)setIsApply:(BOOL)isApply{
  35. _isApply = isApply;
  36. if(isApply){
  37. [self.applyBtn setTitle:NSLocalString(@"mimo_guild_applying") forState:UIControlStateNormal];
  38. self.applyBtn.alpha = 0.4;
  39. }
  40. }
  41. - (void)setCanClick:(BOOL)canClick{
  42. if(self.isApply){
  43. canClick = NO;
  44. }
  45. _canClick = canClick;
  46. if(self.isApply){
  47. }
  48. else{
  49. if(canClick){
  50. self.applyBtn.alpha = 1.0;
  51. }
  52. else{
  53. self.applyBtn.alpha = 0.4;
  54. }
  55. }
  56. }
  57. - (UIButton *)applyBtn{
  58. if(!_applyBtn){
  59. _applyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  60. [_applyBtn addTarget:self action:@selector(applyBtnClick) forControlEvents:UIControlEventTouchUpInside];
  61. [_applyBtn setTitle:NSLocalString(@"mimo_fans_fans_club_create_submit") forState:UIControlStateNormal];
  62. NSArray *applyColorArr = @[kBaseColorLeft,kBaseColorRight];
  63. UIImage *applyImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, (SCREENWIDTH - 32.0 * 2.0), 48.0) Colors:applyColorArr GradientType:0];
  64. [_applyBtn setBackgroundImage:applyImage forState:UIControlStateNormal];
  65. _applyBtn.layer.cornerRadius = 16.0;
  66. _applyBtn.layer.masksToBounds = YES;
  67. [_applyBtn setFont:[MOTextTools poppinsMediumFont:16.0]];
  68. }
  69. return _applyBtn;
  70. }
  71. - (void)applyBtnClick{
  72. self.applyBtnClickBlcok ? self.applyBtnClickBlcok() : nil;
  73. }
  74. @end