Capturing the backspace on the Number Pad Keyboard

Discussion in 'iOS Programming' started by jaycyn94, Jul 29, 2009.

  1. jaycyn94 macrumors newbie


    Jul 18, 2007
    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?
  2. harry65 macrumors member

    Aug 26, 2008
    The method

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

    - (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.

Share This Page