Men, I don’t believe that this will be a problem to me. If I press a key in keyboard, the UITextField delegate trigger the function:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if ([string lenght]==0) NSLog("Backspace was pressed");
}
But the problem is: when the text is empty and I press backspace, this function IS NOT called. There are a way to detect the backspace was pressed in this situation?
Or I will have to send this bug to Apple?
Ps. I need this for the cursor go to previous UITextFild (if have one character and press backspace, it work)
Well I don’t think this is a bug because the textfield is empty and therefore no characters have been changed in the range hence why the method isn’t being fired. The UITextFieldDelegate Documentation by Apple says:
There are no existing characters in the TextField so the method is not fired. It doesn’t help answer the question but it’s not a bug in the SDK
To get the behaviour you want, this question is already answered here: Can I detect the delete key even if the UITextField is empty?