我正在尝试通过将自定义添加为顶部视图控制器的左右 barbuttonitem 来自ABPeoplePickerNavigationController
定义导航栏。此功能在 iOS7 和以前的版本中运行良好,但在 iOS 8 中无法正常运行。UIBarButtonItem
UINavigationController
- (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:)];
}
上面的代码正在执行,但是没有任何效果。PeoplePickerNavigationController 显示其默认导航栏,以及其默认项 Groups 和 Cancel 按钮。
iOS 8 发生了什么变化?我是否需要重新实施,我已经做了什么?
编辑:我在导航堆栈中记录了顶部的 ViewController。它被称为CNContactPicker
。