how to call an action every time user taps on Space Key on the keyboard?

Discussion in 'iOS Programming' started by alexandergre, Aug 6, 2009.

  1. alexandergre macrumors member

    alexandergre

    Joined:
    Jul 28, 2009
    #1
    its like this:
    when the user taps on space button on the keyboard I want to call this action:

    Code:
    UItextfield.text=@"";
    in other words:
    UItextfield.text.clear(); c#
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Probably could check inside the textField:shouldChangeCharactersInRange:replacementString:
    delegate method.
     
  3. alexandergre thread starter macrumors member

    alexandergre

    Joined:
    Jul 28, 2009
    #3
    You are great dude...
    but I found another method which is much simpler.

    I connected the Event Editing changed to an IBAction.
    Code:
    IBAction:
    string input = textfield.text
    int a = textfield.text.lenght 
    if(input[a] isequaltoString @" ")
    {The code to call goese here
     textfield.text=@"";
    }
    :p
     

Share This Page