¿Cómo puedo cambiar el color de UINavigationBar de ABPeoplePickerNavigationController?

Estoy usando ABAddressBookRef para get información de personas para mi libreta de teléfonos. Funciona correctamente, pero quiero cambiar el color de UINavigationBar de ABPeoplePickerNavigationController .

¿Es esto posible o no? Si es posible, dime cómo hacerlo.

Establezca el color del tinte, de esta manera …

 ABPeoplePickerNavigationController *objPeoplePicker = [[ABPeoplePickerNavigationController alloc] init]; [objPeoplePicker setPeoplePickerDelegate:self]; objPeoplePicker.topViewController.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.294 green:0.278 blue:0.247 alpha:1.0]; [self presentModalViewController:objPeoplePicker animated:YES]; 

Cambiar el color UISearchBar

 if( picker.searchDisplayController == nil ) NSLog(@"searchDisplayController is nil"); if( picker.topViewController.searchDisplayController == nil ) NSLog(@"topViewController.searchDisplayController is nil"); 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:@"> "]; } 

Puede usar proxies de apariencia para gobernar la apariencia de la barra de navigation en ABPeoplePickerNavigationController así:

para una barra roja con elementos de button de barra blanca:

 [[UINavigationBar appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setBarTintColor:[UIColor networkingColor]]; [[UIBarButtonItem appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setTintColor:[UIColor whiteColor]]; 

Puede probar este código para cambiar UINavigationBar Color

  abPeoplePicker.navigationBar.tintColor=[UIColor networkingColor]; 
 if ([navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) { UIImage *backGroundImage = [[UIImage imageNamed:kNavigationBarBackGroundImage] stretchableImageWithLeftCapWidth:5 topCapHeight:5]; [[UINavigationBar appearance] setBackgroundImage:backGroundImage forBarMetrics:UIBarMetricsDefault]; } 

Esto afectará a todas las barras de navigation pero establecerá una image de background en lugar de configurar la image de background, pero los sets de color de configuration solo establecerán el color de las barras

Puede probar este código para cambiar el color ABPeoplePickerNavigationController

 objPicker.ViewController.navigationController.navigationBar.tintColor = [UIColor networkingColor]; 

o puede configurar el color RGB

  objPicker.ViewController.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.274 green:0.270 blue:0.268 alpha:0.8]; 

cambie el color de UISearchBar de ABPeoplePickerNavigationController use de esta manera …

 objPicker.ViewController.searchDisplayController.searchBar.tintColor = [UIColor colorWithRed:0.294 green:0.278 blue:0.247 alpha:1.0]; 

Cambio de tintColor de UISearchBar dentro de ABPeoplePickerNavigationController

 picker.topViewController.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]}; 

Prueba esto:

 static BOOL foundSearchBar = NO; - (void)findSearchBar:(UIView*)parent mark:(NSString*)mark { for( UIView* v in [ 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:@" "]; }