जब भी उपयोगकर्ता टाइप करता है, मैं कोशिश करने के लिए नीचे दिए गए कोड का उपयोग कर रहा हूं और textField2पाठ सामग्री को मैच के लिए अद्यतन किया जाता textField1है textField1।
- (BOOL) textField: (UITextField *)theTextField shouldChangeCharactersInRange: (NSRange)range replacementString: (NSString *)string {
if (theTextField == textField1){
[textField2 setText:[textField1 text]];
}
}
हालाँकि, मेरे द्वारा उत्पादित आउटपुट यह है कि ...
textField2 "12" है, जब textField1 "123" है
textField2 "123" है, जब textField1 "1234" है
... जब मैं चाहता हूँ:
textField2 "123" है, जब textField1 "123" है
textField2 "1234" है, जब textField1 "1234" है
मैं क्या गलत कर रहा हूं?