views:

70

answers:

1

How can I get user input of the UIKeyboard on the iPhone? I want to track, if the user hits "backspace" when the firstResponder UITextField is empty. I know how I can track a text change but if the field is empty the text don't change when hit "backspace".

+1  A: 

You can put a single space character as the default textfield text. If it tries to disappear in your textshouldchange delegate then the user hit a backspace. You can remove the leading space before actually using the text result.

hotpaw2
Would be a solution, but don't work for me because I already implement the textChange Notification and the delegates shouldBeginEditing, shouldEndEditing, didEndEditing and didBeginEditing. The firstResponder changes on every user interaction depending on his input.I need a other solution. Is it not possible to get directly the users input on the UIKeyboad?
Thorsten