I have a UITextField in my ViewController
, and the ViewController
conforms UITextField
delegate
. Every thing is fine.
I set the UITextField
clearable mode by:
[myTextField setClearButtonMode:UITextFieldViewModeWhileEditing];
The issue is, when I click the clear button of myTextField
, the delegate method shouldChangeCharactersInRange
cannot be triggered. Otherwise, if I type in characters or manually delete characters one by one, it will be triggered.
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
}
For my understanding, clear the text is an text changed event, and I want to deal with this event in a common way, i.e. in the shouldChangeCharactersInRange
. But it just not work. So, is there any way to connect to the clear text event to the delegate
method? All discussion will be highly appreciated.