MOGuildPhoneNumCell.m 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. // MOGuildPhoneNumCell.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2025/3/16.
  6. //
  7. #import "MOGuildPhoneNumCell.h"
  8. @interface MOGuildPhoneNumCell ()<UITextFieldDelegate>
  9. @end
  10. @implementation MOGuildPhoneNumCell
  11. - (void)awakeFromNib {
  12. [super awakeFromNib];
  13. // Initialization code
  14. //Cell 去除选中效果
  15. self.selectionStyle = UITableViewCellSelectionStyleNone;
  16. self.backgroundColor = [UIColor clearColor];
  17. self.redTagView.layer.cornerRadius = 4.0;
  18. self.redTagView.layer.masksToBounds = YES;
  19. self.redTagView.backgroundColor = [MOTools colorWithHexString:@"#F23051" alpha:1.0];
  20. self.inputTxf.delegate = self;
  21. self.inputTxf.placeholder = @"Please enter Phone number";
  22. self.titleLab.font = [MOTextTools poppinsMediumFont:14.0];
  23. self.inputTxf.font = [MOTextTools poppinsLightFont:14.0];
  24. [self.codeBtn setFont:[MOTextTools poppinsMediumFont:14.0]];
  25. self.bgView.layer.cornerRadius = 8.0;
  26. self.bgView.layer.masksToBounds = YES;
  27. self.codeBtn.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
  28. self.codeBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
  29. self.titleLab.textColor = kBaseTextColor_2;
  30. self.inputTxf.textColor = kBaseTextColor_2;
  31. [self.codeBtn setTitleColor:kBaseTextColor_2 forState:UIControlStateNormal];
  32. UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 2.0, 36.0)];
  33. self.inputTxf.leftView = paddingView;
  34. self.inputTxf.leftViewMode = UITextFieldViewModeAlways;
  35. }
  36. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  37. [super setSelected:selected animated:animated];
  38. // Configure the view for the selected state
  39. }
  40. - (void)toCheckHaveRedTip{
  41. // 创建属性字符串,整体颜色为白色
  42. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:self.titleLab.text attributes:@{NSForegroundColorAttributeName:[MOTools colorWithHexString:@"#737373" alpha:1.0]}];
  43. NSRange redRange = [self.titleLab.text rangeOfString:@"*"];
  44. if(redRange.location != NSNotFound){
  45. // 将最后三个字符的颜色设置为红色
  46. [attributedString addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#FB5374" alpha:1.0] range:redRange];
  47. }
  48. self.titleLab.attributedText = attributedString;
  49. }
  50. - (IBAction)codeBtnClick:(id)sender {
  51. self.getCodeBlock ? self.getCodeBlock() : nil;
  52. }
  53. - (void)textFieldDidEndEditing:(UITextField *)textField
  54. {
  55. if (self.returnTxFText)
  56. {
  57. self.returnTxFText(textField.text);
  58. }
  59. }
  60. @end