char - Cannot delete text in UITextField -
i have implemented max character limit on uitextfield. problem when input max number characters, unable backspace characters. can tell me doing wrong? below code:
-(bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string {
if (textfield == pincode) { if ([textfield.text length]<=3) { return yes; } else { return no; } } else { return yes; } return yes;
}
change condition to:
if ([textfield.text length]<=3 || string.length == 0) { ...
if content of string control character f.e. backspace, length zero