ios - UItextfield shouldChangeCharactersInRange method backSpace not working -
i implement code backspace not working until press delete button in uitextfield want backspace delete.
- (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string { nscharacterset *mycharset = [nscharacterset charactersetwithcharactersinstring:_demo_str]; (int = 0; < [string length]; i++) { unichar c = [string characteratindex:i]; if ([mycharset characterismember:c]) { return yes; } } return no; }
try code. working me
- (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string { nscharacterset *mycharset = [nscharacterset charactersetwithcharactersinstring:_demo_str]; (int = 0; < [string length]; i++) { unichar c = [string characteratindex:i]; if ([mycharset characterismember:c]) { return yes; } else { return no; } } return yes; }
Comments
Post a Comment