| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- //
- // MOGuildPhoneNumCell.m
- // MiMoLive
- //
- // Created by SuperC on 2025/3/16.
- //
- #import "MOGuildPhoneNumCell.h"
- @interface MOGuildPhoneNumCell ()<UITextFieldDelegate>
- @end
- @implementation MOGuildPhoneNumCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- //Cell 去除选中效果
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.backgroundColor = [UIColor clearColor];
-
- self.redTagView.layer.cornerRadius = 4.0;
- self.redTagView.layer.masksToBounds = YES;
- self.redTagView.backgroundColor = [MOTools colorWithHexString:@"#F23051" alpha:1.0];
-
- self.inputTxf.delegate = self;
- self.inputTxf.placeholder = @"Please enter Phone number";
-
- self.titleLab.font = [MOTextTools poppinsMediumFont:14.0];
- self.inputTxf.font = [MOTextTools poppinsLightFont:14.0];
- [self.codeBtn setFont:[MOTextTools poppinsMediumFont:14.0]];
-
- self.bgView.layer.cornerRadius = 8.0;
- self.bgView.layer.masksToBounds = YES;
-
- self.codeBtn.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
- self.codeBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
-
- self.titleLab.textColor = kBaseTextColor_2;
- self.inputTxf.textColor = kBaseTextColor_2;
- [self.codeBtn setTitleColor:kBaseTextColor_2 forState:UIControlStateNormal];
-
- UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 2.0, 36.0)];
- self.inputTxf.leftView = paddingView;
- self.inputTxf.leftViewMode = UITextFieldViewModeAlways;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (void)toCheckHaveRedTip{
- // 创建属性字符串,整体颜色为白色
- NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:self.titleLab.text attributes:@{NSForegroundColorAttributeName:[MOTools colorWithHexString:@"#737373" alpha:1.0]}];
-
- NSRange redRange = [self.titleLab.text rangeOfString:@"*"];
- if(redRange.location != NSNotFound){
- // 将最后三个字符的颜色设置为红色
- [attributedString addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#FB5374" alpha:1.0] range:redRange];
- }
-
- self.titleLab.attributedText = attributedString;
- }
- - (IBAction)codeBtnClick:(id)sender {
- self.getCodeBlock ? self.getCodeBlock() : nil;
- }
- - (void)textFieldDidEndEditing:(UITextField *)textField
- {
- if (self.returnTxFText)
- {
- self.returnTxFText(textField.text);
- }
- }
- @end
|