ABPeoplePickerNavigationController search bar color and doesn't get changed

675 Views Asked by At

I'm trying to change the color of the search bar orange and the bar tint color to white when a contact get selected.

No matter what I've been trying, nothings get changed and it's stuck like this (back button isn't white).

in AppDelegate:

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearanceWhenContainedIn:[UINavigationController class], nil] setBarTintColor:OrangeOfficialColor];

[[UINavigationBar appearance] setBarTintColor:OrangeOfficialColor];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

When popping the view:

ABPeoplePickerNavigationController *contactsPicker = [[ABPeoplePickerNavigationController alloc] init];
    contactsPicker.peoplePickerDelegate = self;
    contactsPicker.displayedProperties = @[[NSNumber numberWithInt:kABPersonPhoneProperty]];

    [contactsPicker.searchDisplayController.searchBar setBarTintColor:OrangeOfficialColor];
    [contactsPicker.searchDisplayController.searchBar setTintColor:[UIColor whiteColor]];

    [self presentViewController:contactsPicker animated:YES completion:nil];
  1. View is OK: enter image description here

  2. View isn't OK: enter image description here

  3. View isn't OK: enter image description here

1

There are 1 best solutions below

0
kevinl On

I had the same issue once I started using Xcode 6 (iOS 8 SDK) and iOS 7 apps. This was my workaround fix:

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue" size:16.0f], NSForegroundColorAttributeName : [UIColor blueColor]} forState:UIControlStateNormal];