| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- //
- // MOGuildNewInputCell.m
- // MiMoLive
- //
- // Created by SuperC on 2025/3/16.
- //
- #import "MOGuildNewInputCell.h"
- @interface MOGuildNewInputCell ()<UITextFieldDelegate>
- @end
- @implementation MOGuildNewInputCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
-
- //Cell 去除选中效果
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.backgroundColor = [UIColor clearColor];
-
- self.redTipView.layer.cornerRadius = 4.0;
- self.redTipView.layer.masksToBounds = YES;
- self.redTipView.backgroundColor = [MOTools colorWithHexString:@"#F23051" alpha:1.0];
-
- self.inputTxf.delegate = self;
- self.inputTxf.placeholder = @"Please enter";
-
- self.titleLab.font = [MOTextTools poppinsMediumFont:14.0];
- self.inputTxf.font = [MOTextTools poppinsLightFont:14.0];
-
- self.inputTxf.layer.cornerRadius = 8.0;
- self.inputTxf.layer.masksToBounds = YES;
-
- self.titleLab.textColor = kBaseTextColor_2;
- self.inputTxf.textColor = kBaseTextColor_2;
-
- UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 12.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)textFieldDidEndEditing:(UITextField *)textField
- {
- if (self.returnTxFText)
- {
- self.returnTxFText(textField.text);
- }
- }
- - (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;
- }
- - (void)setIsHaveRedTip:(BOOL)isHaveRedTip{
- _isHaveRedTip = isHaveRedTip;
-
- self.redTipView.hidden = !isHaveRedTip;
- if(isHaveRedTip){
- self.titleLabLeading.constant = 28.0;
- }
- else{
- self.titleLabLeading.constant = 16.0;
- }
- }
- @end
|