所以,我有tableView
NSFetchedResultsController
!我还有UISearchController
,效果很好!但我需要UISearchBar
的范围栏。如何创建以及如何在Swift Core Data中添加Scope Bars?
谢谢!
答案 0 :(得分:2)
在您从UISearchController获取搜索栏时scopeButtonTitles
。当您显示搜索控制器时,将搜索结果控制器设置为搜索栏的委托,因此当用户更改范围按钮时它将获得searchBar:selectedScopeButtonIndexDidChange:
,您只需调用updateSearchResultsForSearchController
并将搜索作为搜索处理你已经在做了 - 现在考虑当前范围按钮索引是什么。