Xav*_*ero 12 iphone uinavigationcontroller abpeoplepickerview ios ios8
我正在尝试自定义ABPeoplePickerNavigationController的导航栏,通过添加自定义UIBarButtonItem作为UINavigationController顶视图控制器的左右barbuttonitem .此功能在iOS7和以前的版本中运行良好,但在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:)];
}
Run Code Online (Sandbox Code Playgroud)
上面的代码正在执行,但它没有任何效果.PeoplePickerNavigationController显示其默认导航栏,其默认项为"组"和"取消"按钮.
iOS 8有什么变化?我需要重新实施,我已经做了什么?
编辑:我在导航堆栈中记录了顶部的ViewController.它被称为CNContactPicker.
我来一枪:
在 ios 8 中,我相信苹果已经以某种方式将其变成了扩展。这意味着该代码是联系人应用程序的。它可能在另一个上下文中运行。
我认为这是因为我读到您不再需要要求用户访问联系人列表才能使用这些选择器。这必定意味着它们并不是您自己的应用程序的真正一部分,即扩展。
可能有一种方法可以防止这种情况发生。我敢打赌,您必须将 ABAddressBook 传递给选择器才能执行此操作。
| 归档时间: |
|
| 查看次数: |
1119 次 |
| 最近记录: |