0

i have a tab bar controller in witch i would like to embed a ABPeoplePickerNavigationController. I' done so by putting this code in viewDidLoad

[super viewDidLoad];
_addressBookController = [[ABPeoplePickerNavigationController alloc] init];
[_addressBookController setDelegate:self];
[_addressBookController setPeoplePickerDelegate:self];
[self.view addSubview:_addressBookController.view];

my problem is that i would like to uniform the ABPeople controller to my app bgcolor and tint, but actually i'm only able to change the title of the navigation controller via the method below

- (void)navigationController:(UINavigationController *)navigationController
      willShowViewController:(UIViewController *)viewController
                    animated:(BOOL)animated

can some help me to change all colors and tints?

Thanks in advice

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

0

You can change the style of the ABPeoplePickerNavigationController using the appearanceWhenContainedIn method (iOS > 5). Remember to do your customization before loading the view controller.

Here an example:

[[UINavigationBar appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setBarTintColor:[UIColor yourColor]];
[[UIBarButtonItem appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setTintColor:[UIColor yourColor]];
[[UINavigationBar appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor yourColor], NSFontAttributeName : [UIFont yourFont]}]; //navigation bar title
[[UISearchBar appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setBarTintColor:[UIColor yourColor]];
[[UITableView appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setSectionIndexColor:[UIColor yourColor]];
[[UITableViewHeaderFooterView appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setTintColor:yourColor];

If you want a full list of what properties you can change, you can look at this question: What properties can I set via an UIAppearance proxy?

Community
  • 1
  • 1
andreacipriani
  • 2,519
  • 26
  • 23