Question

I've got an app with the following class:

@interface SearchViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate>
@property (nonatomic, retain) IBOutlet UISearchBar *search;

How can I customize UISearchBar? I'd like to add a segmented button to allow for search options (and/or/phrase).

Was it helpful?

Solution

Try this:

search.showsScopeBar = YES;
search.scopeButtonTitles = [NSArray arrayWithObjects:@"Button",@"Titles",@"Go",@"Here",nil];

That gives you the standard segmented control for search. You can use search.selectedScopeButtonIndex to check its state.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top