gpt4 book ai didi

iOS 8 : Cannot change the navigation bar at all of the ABPeoplePickerNavigationController

转载 作者:可可西里 更新时间:2023-11-01 05:04:24 25 4
gpt4 key购买 nike

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

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

我懒惰地实例化我的导航 Controller 和其他方法调用,如关闭 View Controller 等。工作正常。

编辑:这是我当前的代码(用于赏金)。没有像这样发生颜色变化:

- (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];
}

这在 iOS8 上不再有效了吗?

最佳答案

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

[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

只需将其放入您从中启动 ABPeoplePickerView 的 View Controller 的 viewDidLoad 方法中。这也适用于 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];

关于iOS 8 : Cannot change the navigation bar at all of the ABPeoplePickerNavigationController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26039809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com