gpt4 book ai didi

ios - 文本字段确实开始编辑未在自定义单元格上调用

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:54:27 27 4
gpt4 key购买 nike

我在表格 View 上有自定义单元格。单元格有一个文本字段。例如,如果我有 4 个单元格,每个单元格都有文本字段。我能够点击三个文本字段,并且相关的文本字段开始编辑。但是对于其中一个文本字段,当我点击它时 - 没有调用文本字段确实开始编辑。这是我的方法

  -(void)textFieldDidBeginEditing:(UITextField *)textField{

NSString *SelectedIndexString = [[NSUserDefaults standardUserDefaults]
stringForKey:@"SelectedIndex"];
NSInteger selectionCount = [SelectedIndexString integerValue];
NSLog(@"%ld",(long)selectionCount);

if (selectionCount) {
self.accountNameTxtField.enabled = NO;
}
else{
self.accountNameTxtField.enabled = YES;


}
}

// STTableViewCell

@interface STTableViewCell () <UITextFieldDelegate>
- (void)awakeFromNib {
[super awakeFromNib];
radioBtn.alpha = 0; // Initialization code [self customBorder];
// Setting the OTP label color to the RGB blue
self.OTPLabel.textColor = [UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0];
// Set delegate to textfield
self.accountNameTxtField.delegate=self;
}

- (void)setEditing:(BOOL)editing animated:(BOOL)animated {

[super setEditing:editing animated:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(incomingNotification:) name:@"No Change" object:nil];

if (!editing)
{

radioBtn.alpha = 0;
isTableviewEditing=NO;
if (![self.authURL.name isEqual:accountNameTxtField.text]) {

self.accountNameTxtField.text = [self.accountNameTxtField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if (accountNameTxtField.text.length >= 1)
{
// Write out the changes.
descriptionBlank = NO;

self.authURL.name = self.accountNameTxtField.text;
[self.authURL saveToKeychain];
}
else{
[accountNameTxtField resignFirstResponder];
[self.delegate cellDidTap:self];
self.accountNameTxtField.text =self.authURL.name;
descriptionBlank = YES;
}

}
accountNameTxtField.userInteractionEnabled=NO;
[accountNameTxtField resignFirstResponder];
for (CALayer *layer in accountNameTxtField.layer.sublayers) {
if ([layer.name isEqualToString:@"Gradient"])
{
[layer setHidden:YES];
break;
}
}

progressView.alpha=1.0;
OTPLabel.alpha=1.0;

}
else
{
radioBtn.alpha = 1;
isTableviewEditing=YES;

for (CALayer *layer in accountNameTxtField.layer.sublayers) {
if ([layer.name isEqualToString:@"Gradient"])
{
[layer setHidden:NO];
break;
}
}

OTPLabel.alpha=0.0;
progressView.alpha=0.0;
accountNameTxtField.userInteractionEnabled=YES;

}
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
if (selected) {`selectHilightCount++;
self.accountNameTxtField.enabled = NO;
} else {
self.accountNameTxtField.enabled = YES;
}`
}

最佳答案

请设置代表。喜欢:

cell.txtFld.delegate = self;

希望对你有帮助,谢谢

关于ios - 文本字段确实开始编辑未在自定义单元格上调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41632707/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com