提问人:subbu 提问时间:5/5/2017 最后编辑:BSMPsubbu 更新时间:5/6/2017 访问量:387
SearchBar 方法已弃用问题
SearchBar method deprecated issue
问:
我使用了这种方法,但它说它已被弃用。我应该使用哪种方法代替此方法?
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
[self filterContentForSearchText:searchString scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
return YES;
}
答:
0赞
Lalit kumar
5/5/2017
#1
UISearchDisplayController 类替换 UISearchController 类
- (void)updateSearchResultsForSearchController:(UISearchController *)searchController
{
// Your logic here
}
- (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NSInteger)selectedScope
{
//[self updateSearchResultsForSearchController:searchController];
}
0赞
user3182143
5/6/2017
#2
UISearchDisplayController 在 iOS 8 中已弃用。(请注意, UISearchDisplayDelegate 也已弃用。要管理 在 iOS 8 中显示搜索栏并显示搜索结果,以及 稍后,请改用 UISearchController。
评论
UISearchDisplayDelegate
Important: UISearchDisplayDelegate is deprecated in iOS 8. (Note that UISearchDisplayController is also deprecated.) To manage the presentation of a search bar and display search results in iOS 8 and later, instead use UISearchControllerDelegate.