UISearchbar clearButton forces the keyboard to appear

Posted by DASKAjA on Stack Overflow See other posts from Stack Overflow or by DASKAjA
Published on 2009-07-07T13:06:42Z Indexed on 2010/05/12 22:24 UTC
Read the original article Hit count: 430

I have a UISearchBar which acts as a live filter for a table view. When the keyboard is dismissed via endEditing:, the query text and the gray circular "clear" button remain. From here, if I tap the gray "clear" button the keyboard reappears as the text is cleared.

How do I prevent this? If the keyboard is not currently open I want that button to clear the text without reopening the keyboard.

There is a protocol method that gets called when I tap the clear button. But sending the UISearchBar a resignFirstResponder message doesn't have any effect on the keyboard.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uisearchbar