I ran into the same problem. Changing the color of navBar is very simple. The color change of the UISearchBar, however, is not much. I checked first
if( picker.searchDisplayController == nil ) NSLog(@"searchDisplayController is nil"); if( picker.topViewController.searchDisplayController == nil ) NSLog(@"topViewController.searchDisplayController is nil");
Both times the searchDisplayController was zero. What I ended up with is moving the view hierarchy to find the UISearchBar view. There, of course, is right. So this is my last code. If anyone has a better solution, I would love to hear that.
static BOOL foundSearchBar = NO; - (void)findSearchBar:(UIView*)parent mark:(NSString*)mark { for( UIView* v in [parent subviews] ) { if( foundSearchBar ) return; NSLog(@"%@%@",mark,NSStringFromClass([v class])); if( [v isKindOfClass:[UISearchBar class]] ) { [(UISearchBar*)v setTintColor:[UIColor blackColor]]; foundSearchBar = YES; break; } [self findSearchBar:v mark:[mark stringByAppendingString:@"> "]]; } } - (void)pickPerson:(BOOL)animated { foundSearchBar = NO; ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; [[picker navigationBar] setTintColor:[UIColor blackColor]]; picker.peoplePickerDelegate = self; picker.displayedProperties = [NSArray arrayWithObjects: [NSNumber numberWithInt:kABPersonEmailProperty], nil]; [self presentModalViewController:picker animated:animated]; [picker release]; [self findSearchBar:[picker view] mark:@"> "]; }
source share