Matt
Matt

Reputation: 556

Customized UISearchBar

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).

Upvotes: 2

Views: 3956

Answers (1)

Tom
Tom

Reputation: 3861

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.

Upvotes: 7

Related Questions