开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜