How to check programatically keyboard presense?

Discussion in 'iOS Programming' started by sspbond007, Sep 28, 2009.

  1. sspbond007 macrumors member

    Joined:
    Aug 19, 2008
    #1
    Hi,

    I need to check condition is keyboard appearing, in my app.

    like:

    if(keyboardIsPresentOnWindow){
    Do action 1;
    }else if(keyboardIsPresentOnWindow){
    Do action 2;
    }

    So please help how to check this condition?

    Thanks.
     
  2. skunkworker macrumors regular

    Joined:
    Sep 9, 2007
    #2
    Usually the keyboard will be invoked because a textfield or area will become first responder. (pretty much meaning its focused and the keyboard appears). Can you give us some more context in code?
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    When the keyboard appears/disappears a notification is sent. Subscribe to this notification and you'll know if the keyboard is present. Also, the keyboard appears when a textview or textfield is made the first responder. Probably you can query any textfield/view to see if they are the first responder.
     

Share This Page