Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jaycyn94

macrumors newbie
Original poster
Jul 18, 2007
17
0
I'm trying to setup a PIN login page to my app that looks and functions similar to the PIN page on the phone itself when locked. However, I can't seem to find a way to detect when they press the backspace key when one of the input boxes is empty. It doesn't seem that any of the events on the UITextField get fired when it is pressed.

Anyone have any idea on how to capture this?
 
The method

Code:
textField:shouldChangeCharactersInRange:replacementString:

certainly catches the backspace key, but as you said, not when the text field is already empty. In fact, adding

Code:
- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
with UIControlEventAllEvents does not even catch this case. My only conclusion is that Apple does not send any sort of event when the backspace key is pressed and the text field is already empty. Very strange.

My only 'solution' would be to try and create an 'invisible' button that gets over-layed on the backspace key on the keyboard and catch the event for the button. However, getting a view to appear above the keyboard view.... I'm not sure how to do this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.