2017-12-03 212 views

回答

2

你需要實現你的searchBardelegatesearchBarSearchButtonClicked:和/或searchBarTextDidEndEditing:

- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar; 

這裏面的委託方法添加searchBar.text您想要的數組:只要用戶按下搜索按鈕或編輯完在搜索欄中的文本,分別

+0

謝謝!我原本試過,但忘了設置代表。所以其他人知道'類YourSearchTableViewController:UITableViewController,UISearchResultsUpdating,UISearchBarDelegate {'和'searchController.searchBar.delegate = self' – rdk

1

有委託這些方法被調用。