I have text field in that i have to some functionality click on back space button in keyboard when the text field is empty …shouldChangeCharactersInRange is calling when the textfield has some text.how call solve this problem.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can catch that key in
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)stringIt is not written explicitly in the docs but if you press the backspace key then the last parameter
stringwill have a length of 0.At least this worked for me when using UITextView objects.
Hope this helps 🙂