Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISearchBAR scopeBar tintColor

Tags:

uisearchbar

Has anyone managed to color the scopebar portion of a UISearchBar, it has a tintColor property but setting it does not affect the attached scopebar UISegmentedControl. Ive got a handle on the bar to tint it but doesnt seem to work ie:

for (id subview in searchBar.subviews){
  if([subview isMemberOfClass:[UISegmentedControl class]]){
     UISegmentedControl *scopeBar=(UISegmentedControl *) subview;
    scopeBar.tintColor=UIColorFromRGB(0x990066);
 }
}

Cheers, Neil

like image 452
Neil Edwards Avatar asked Nov 02 '09 12:11

Neil Edwards


1 Answers

The above approaches weren't working for me and I ended up using an iOS appearance method.

[[UISegmentedControl appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor whiteColor]];
like image 140
raidfive Avatar answered Nov 25 '22 11:11

raidfive