UISearchBar keyboard won't retract

Discussion in 'iOS Programming' started by beachdog, Sep 12, 2008.

  1. beachdog macrumors member

    Joined:
    Aug 10, 2008
    #1
    I have a UISearchBar control in my navbar and it is working fine, except that when the user clicks 'Search' I would like the keyboard to retract so that it uncovers the bottom half of my table view. For some reason -- not sure if its designed that way or I'm doing something wrong -- when the user clicks 'Search' the keyboard stays up. Everything else is working fine -- I get the delegate message and perform the search etc. Is there a way I can programmatically tell the keyboard to retract and disappear?
     
  2. jchildress macrumors member

    Joined:
    Jul 9, 2008
    #2
    Take a look at Apple's "TableSearch" example code. In the "MainViewController.m" file there is the following line "[searchBar resignFirstResponder];". I've never used this method like this before but this may be what you need.

    I've used the FirstResponder in the opposite manner to have a textField automatically turn on its keyboard when a view appears.
     
  3. fenrus110 macrumors regular

    Joined:
    Mar 24, 2008
    #3
    why don't you just resignFirstResponder in your delegate?
     
  4. springframework macrumors member

    Joined:
    Mar 31, 2008
    #4
    the apple uisearchbar tutorial didn't work for me either.

    i searched on google 'uisearchbar' and found a blog and it. worked like a charm!
     
  5. beachdog thread starter macrumors member

    Joined:
    Aug 10, 2008

Share This Page