1

The navigation bar in my app has white text and when the user opens the address book it should be the normal color (blue text). I tried changing the text color before pushing the address book view but the titles (groups, cancel) are still white. How can I solve this problem? Any help is appreciated.

edit: The title in the middle (all contacts) is like default black.
I already tried

self.navigationController.navigationBar.tintColor = [UIColor blueColor];
self.navigationItem.rightBarButtonItem.tintColor = [UIColor blueColor];
self.navigationItem.leftBarButtonItem.tintColor = [UIColor blueColor];

before pushing the address book view, but that didn't work.
I also tried

[picker.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor blueColor] forKey:NSForegroundColorAttributeName]];
picker.navigationController.navigationBar.tintColor = [UIColor blueColor];
picker.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor blueColor] forKey:NSForegroundColorAttributeName];

but these didn't work neither.

Fixed the problem with

[[UIBarButtonItem appearance] setTintColor:nil];
user2414460
  • 211
  • 3
  • 14

1 Answers1

0
UINavigationController *nac = [[[UINavigationController alloc] initWithRootViewController:addBookViewController]autorelease];
NSDictionary *textAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                [UIColor whiteColor],NSForegroundColorAttributeName,
                                [UIColor whiteColor],NSBackgroundColorAttributeName,nil];

nac.navigationBar.titleTextAttributes = textAttributes;
[nac.navigationBar setTintColor:[UIColor whiteColor]];
chrios
  • 1
  • I don't have a AddressbookViewController. I push the view with `ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; picker.peoplePickerDelegate = self; [self presentViewController:picker animated:YES completion:nil];` – user2414460 Jan 10 '14 at 09:40
  • The ABPeoplePickerNavigationController is a subclass of UINavigationController. Try picker.navigationBar.titleTextAttributes = textAttributes; [picker.navigationBar setTintColor:[UIColor whiteColor]]; – chrios Jan 10 '14 at 10:46