PYSearch
PYSearch copied to clipboard
怎么突然改了,有点措手不及,还是我一直没有更新?
之前是这个方法,点子点击的话怎么拿到索引呢? PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:[hotSeaches copy] searchBarPlaceholder:@"输入感兴趣的内容" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText, NSInteger section, NSInteger rows) {
@al1020119 这样的,block没有提供索引的。你可以通过代理方法分别获取热门搜索/搜索历史/搜索建议的索引。如下
/**
Called when popular search is selected.
@param searchViewController search view controller
@param index index of tag
@param searchText text for search
Note: `searchViewController:didSearchWithSearchBar:searchText:` will not be called when this method is implemented.
*/
- (void)searchViewController:(PYSearchViewController *)searchViewController
didSelectHotSearchAtIndex:(NSInteger)index
searchText:(NSString *)searchText;
/**
Called when search history is selected.
@param searchViewController search view controller
@param index index of tag or row
@param searchText text for search
Note: `searchViewController:didSearchWithSearchBar:searchText:` will not be called when this method is implemented.
*/
- (void)searchViewController:(PYSearchViewController *)searchViewController
didSelectSearchHistoryAtIndex:(NSInteger)index
searchText:(NSString *)searchText;
/**
Called when search suggestion is selected.
@param searchViewController search view controller
@param index index of row
@param searchText text for search
Note: `searchViewController:didSearchWithSearchBar:searchText:` will not be called when this method is implemented.
*/
- (void)searchViewController:(PYSearchViewController *)searchViewController
didSelectSearchSuggestionAtIndex:(NSInteger)index
searchText:(NSString *)searchText PYSEARCH_DEPRECATED("Use searchViewController:didSelectSearchSuggestionAtIndexPath:searchText:");