IOS - Keep ScopeBar even after clicking Cancel

I set setShowsScopeBar to TRUE from the start and it works fine. But as soon as I search for something and then cancel the search, the Scope panel will disappear.

How to save scope even after clicking Cancel?

Apparently, in an earlier version, with the UISearchBar,

    - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar
{
    [searchBar setShowsScopeBar:YES];
    return YES;
}

It worked. But with SearchController this is no longer the case.

I tried this:

- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
    searchController.searchBar.showsScopeBar = YES;
    [searchController.searchBar sizeToFit];
    isSearching = NO;
}

no luck.

Are there any possible solutions on iOS 9?

+4
source share
2 answers

A direct way to keep the visibility bar always visible if you are not using some hacks.

UISegmentedControl, . - updateSearchResultsForSearchController: .

0

- UISegmentedControl UISegmentedControlStyleBar. tintColor, . , - .

0

Source: https://habr.com/ru/post/1617218/


All Articles