Reputation: 25731
I want to change the appearance of the UISearchController and its components.
I am fine with the text field and its color, but I want to control the colors of:
1. search and scope bar background color (currently default is gray)
2. color of text in scope bar (both selected and unselected)
3. color of borders of scope bar
4. color of inside of the scope bar (both selected and unselected)
Thanks.
Upvotes: 0
Views: 2875
Reputation: 2941
For scope bar
for (id subview in searchBar.subviews){
if([subview isMemberOfClass:[UISegmentedControl class]]){
UISegmentedControl *scopeBar=(UISegmentedControl *) subview;
[scopeBar setTintColor: [UIColor bluecolor]];//THis also your color for selected segment
}
}
For search bar.
yourDisplayController.searchBar.backgroundImage = [[UIImage alloc] init]
yourDisplayController.searchBar.backgroundColor = [UIColor redColor];
For color of text in scope bar
[searchBar setScopeBarButtonTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
[searchBar setScopeBarButtonTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor greenColor], NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
color of borders of scope bar and color of inside of the scope bar see the first answer as don't understand what you meant by inside.
Upvotes: 1