How can I programmatically force a search in the UISearchBar?

后端 未结 8 1208
遥遥无期
遥遥无期 2021-02-05 05:15

How can I force the UISearchBar to automatically start a new search (like pressing the Search button)? Is there an easy way to achieve this?

8条回答
  •  野性不改
    2021-02-05 05:58

    You can force your searchBar,

    Objective C:

    [self searchBar:yourSearchBarName textDidChange: yourSearchingString];
    

    Swift 3.0:

    self.searchBar(self.yourSearchBarName, textDidChange: yourSearchingString)
    

    This will trigger your searchBar.

提交回复
热议问题