我从一开始就将setShowsScopeBar设置为TRUE,这非常有效.但是一旦我搜索了某些内容然后取消了我的搜索,Scope Bar就会消失.
How to keep scopebar even after pressed Cancel button?
显然,在早期版本中,使用UISearchBar,
- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar { [searchBar setShowsScopeBar:YES]; return YES; }
这很有效.但是使用SearchController,情况就不再如此了.
我试过这个:
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { searchController.searchBar.showsScopeBar = YES; [searchController.searchBar sizeToFit]; isSearching = NO; }
没有运气.
iOS 9上有没有可能的解决方案?