IPhone: hide scope from searchBar

I will look stupid again, but it's better than going crazy! Here is my problem. I have a UISearchBar that has a scopeBar that I want to hide. I'm doing it:

searchBar.showsScopeBar = NO;

and I also call

[searchBar becomeFirstResponder];

at the end of the function, but it does not work.

Any idea?

thank

+3
source share
2 answers

Well, for those who have the same problem, to hide the scope, you really need to set the scopeButtonTitles property to nil:

searchbar.scopeButtonTitles = nil;

and install them programmatically if you want to show scopeBar:

searchbar.scopeButtonTitles = [NSArray arrayWithObject:@"Button 1", @"Button 2",...,nil];

It works. The showScopeBar property must be true.

searchBar.showsScopeBar = YES;
+7
source

IB. "", , - . , , . 2 . Voila, .

+2

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


All Articles