12

I am trying to customise ABPeoplePickerNavigationController's navigation bar, by adding custom UIBarButtonItem as left and right barbuttonitem of UINavigationController's top view controller. This feature was working fine in iOS7 and previous versions, but not in iOS 8.

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

 navigationController.topViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addNewContact:)];

 navigationController.topViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
}

The above code is being executed, but it has no effect. The PeoplePickerNavigationController shows its default navigation bar, with its default items Groups and Cancel buttons.

What has changed in iOS 8? Do i need to re-implement, what I have already done?

Edit: I logged the top ViewController in the navigation stack. It is called CNContactPicker.

Xavi Valero
  • 2,047
  • 7
  • 42
  • 80

1 Answers1

1

I'll take a shot:

In ios 8 I believe Apple has made this into an extension somehow. That means the code is the Contacts app's. It's probably running in another context.

I think this because I read that you no longer need to ask the user for contact list access to use these pickers. That must mean that they're not really part of your own app, i.e. an extension.

There might be a way to prevent this. My bet is that you'd have to pass an ABAddressBook to the picker to do this.

Andreas
  • 2,665
  • 2
  • 29
  • 38