iOS 8:无法更改所有ABPeoplePickerNavigationController的导航栏

Mic*_*iZH 4 abpeoplepickerview ios

我尝试将ABPeoplePickerNavigationController导航栏的颜色更改为我的app颜色.但是没有发生变化.即使我试图隐藏它或至少改变状态栏色调颜色,也没有任何反应.为什么?

- (ABPeoplePickerNavigationController *)peoplePicker
{
    if(!_peoplePicker){
        _peoplePicker = [[ABPeoplePickerNavigationController alloc]init];
        _peoplePicker.peoplePickerDelegate = self;
        _peoplePicker.navigationBar.hidden = YES;
    }
    return _peoplePicker;
}
Run Code Online (Sandbox Code Playgroud)

我懒惰实例化我的导航控制器和其他方法调用,如解除视图控制器等工作正常.

编辑:这是我目前的代码(为赏金).没有像这样的颜色变化:

- (ABPeoplePickerNavigationController *)peoplePicker
{
    if(!_peoplePicker){
        _peoplePicker = [[ABPeoplePickerNavigationController alloc]init];
        _peoplePicker.peoplePickerDelegate = self;
        _peoplePicker.navigationBar.tintColor = [UIColor blackColor];
    }
    return _peoplePicker;
}

- (IBAction)addressBookButtonClicked:(id)sender {
    [self presentViewController:self.peoplePicker animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

这不再适用于iOS8吗?

Kea*_*son 7

实际上,由于上​​面的评论,我意识到外观代理应该像这样工作:

[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
Run Code Online (Sandbox Code Playgroud)

只需将它放在View Controller的viewDidLoad方法中,您就可以从中发起ABPeoplePickerView.这也适用于MFMailerView.我用来正确设置我的酒吧样式的代码是:

[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont
                                                                       fontWithName:@"Helvetica Neue" size:12], NSFontAttributeName,
                            [UIColor whiteColor], NSForegroundColorAttributeName, nil];

[[UINavigationBar appearance] setTitleTextAttributes:attributes];
Run Code Online (Sandbox Code Playgroud)