views:

21

answers:

1

Hi all.

I'm going to look silly again, but it's better than getting crazy! Here's my issue. I have a UISearchBar which has a scopeBar that I want to hide. I do this :

searchBar.showsScopeBar = NO;

and I also call the

[searchBar becomeFirstResponder];

method at the end of the function, but it doesn't work.

Any idea ?

Thanks

A: 

Okay, for those having the same issue, to hide a scopeBar, you actually need to set the scopeButtonTitles property to nil :

searchbar.scopeButtonTitles = nil;

and set them programatically when you want to show the scopeBar :

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

That works. The showsScopeBar property has to be true.

searchBar.showsScopeBar = YES;
Julien