Reputation: 627
For the UISearchBar
's scopebar I want to set images instead of titles to identify different scopes. I found only scopeButtonTitles
method to set titles in the UISearchBar
class reference. Is there a way to set images for the scopes?
Upvotes: 2
Views: 624
Reputation: 145
Very simple:
// use Appearance proxy:
id temp = [UISegmentedControl appearanceWhenContainedIn:[UISearchBar class], nil];
UIImage * img = [UIImage imageNamed:@"my_img1"];
[temp setImage:img forSegmentAtIndex: 0];
img = [UIImage imageNamed:@"my_img2"];
[temp setImage:img forSegmentAtIndex: 1];
.....
Upvotes: 1