我的方法如下,错误的工作,当我将22222222222写入TCKimlik文本字段时,必须写入AdText.text = @“AYŞE”;但是这种方法将AYŞE写入TCKimlikText.AdText文本字段显示为空。我怎么解决?
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
if ([[TCKimlikText.text stringByReplacingCharactersInRange:range withString:string] isEqual:@"22222222222"])
{
cinsiyetBtn.titleLabel.text = @"BAYAN";
AdText.text = @"AYŞE";
uyrukBtn.titleLabel.text = @"TC";
babaAdiText.text = @"KEMAL";
anneAdiText.text = @"ZELİHA";
soyadiText.text = @"AYDIN";
anneKizlikSoyadiText.text = @"DEMİRCİ";
dogumTarihiText.text = @"01/01/1963";
medeniDurumBtn.titleLabel.text = @"EVLİ";
//EsinizinAdiText.text = @"AYŞE";
dogumYeriBtn.titleLabel.text = @"BURSA";
kimlikBtn.titleLabel.text = @"Nüfus Cüzdanı";
//KimlikVerilisNedeniText.text = @"YENİLEME";
//KimlikVerilisTarihi.text = @"12/01/2010";
kimlikSeriNoText.text = @"57689";
vergiKimlikNoText.text = @"45678";
kimlikSiraNoText.text = @"5443126274";
yakinlikBtn.titleLabel.text = @"EŞİ";
kizlikSoyadiText.text = @"YILMAZ";
}
return YES;
}
答案 0 :(得分:0)
您是否测试了if-clause中的代码是否完全被调用? 如果是这样,请检查XIB文件的属性,可能是xib和代码之间的连接已断开(未链接)。否则,请尝试:
if ([[TCKimlikText.text stringByReplacingCharactersInRange:range withString:string] isEqual:@"22222222222"])
{
NSLog("Success");
// Rest of your code...
}
查看您的陈述是否正确。 希望这有帮助!