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
.