UISearchbar clearButton forces the keyboard to appear

后端 未结 12 1927
暖寄归人
暖寄归人 2020-11-30 20:40

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 rem

12条回答
  •  Happy的楠姐
    2020-11-30 21:12

    Of of the search bar delegate calls asks you to accept a change from an old value to a new one - you could detect that the new value was nil, along with the old value being not-nil, and an indicator that the user had not typed anything since the keyboard was last up - then in that case resign first responder for the search bar. Not sure if the keyboard will momentarily display though.

    I have a very similar situation and may try that myself.

提交回复
热议问题