If I type开发者_StackOverflow a very long text in my UITextField, for example: 123456789012345678901234567890.
Now if I press the backspace and leave it pressed, then the shouldChangeCharactersInRange is called for some characters in the beginning.
But, then when the UITextField start getting cleared with a fast speed, the shouldChangeCharactersInRange stops getting called. Can anyone suggest me a solution.
You can add observer for the UITextFieldTextDidChangeNotification which will be posted whenever the text changes in text field.
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(yourMethod:)
name:UITextFieldTextDidChangeNotification
object:yourTextField];
In this case, yourMethod: method will always work.
精彩评论