iPhone, how to capture when a search bar is empty and has text?
I need to disabled a button when theres no text in the sea开发者_运维问答rch bar and enable the button when there is text in it.
I presume there must be an event or a way to detect the status of the text in the search bar ?
I would utilize the UISearchBarDelegate class and implement the textDidChange method (UISearchBarDelegate reference).
You can use this to "detect" changes to the search field and change the enable state of the button as the user edits the contents of the search bar.
精彩评论