繁体   English   中英

iOS 9联系人列表按钮白色

[英]iOS 9 Contact List buttons White on White

我意识到ABPeoplePicker已针对iOS 9进行了更改,但该功能仍然存在并且目前可以正常使用。 我遇到的问题是“组”和“取消”按钮在白色背景上显示为白色。 很难看。 以前使用的控制器确实在其导航栏中使用了白色按钮,但背景当然更暗。

我尝试使用以下在iOS 8下有效的方法,但在iOS 9下似乎无能为力:

[[UIBarButtonItem appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil] setTintColor:[UIColor blueColor]];

我试图直接使用navigationcontroller.navbar.tintcolor属性进行设置。 在8岁或9岁以下无法正常工作。

如何使这些按钮在联系人页面上可见?

更新:我也尝试过这不起作用:

[[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[ABPeoplePickerNavigationController class]]] setTintColor:[UIColor blueColor]];

更新2:我尝试使用新的CNContactPickerViewController并且在白底白字上也做同样的事情。

我之前也遇到过这个问题。 要解决此问题,您需要为UINavigation栏设置色调颜色,如下所示:

[[UINavigationBar外观] setTintColor:[UIColor blueColor]];

例如:

- (void)showContactList 
{

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

    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];

    picker.peoplePickerDelegate = self;

    [self presentViewController:picker animated:YES completion:nil];
}

我不知道如何,但这对我有用:

// Text color of navigation bar
    let textAttributes = [NSForegroundColorAttributeName:UIColor.color_template_1_2()]
    UINavigationBar.appearance().titleTextAttributes = textAttributes
    UINavigationBar.appearance().tintColor = UIColor.color_template_1_2()

    let contactPicker = CNContactPickerViewController()

    contactPicker.delegate = self
    contactPicker.displayedPropertyKeys =
        [CNContactPhoneNumbersKey]
    self.present(contactPicker, animated: true, completion: {
        let textAttributes2 = [NSForegroundColorAttributeName:UIColor.white]
        UINavigationBar.appearance().titleTextAttributes = textAttributes2
        UINavigationBar.appearance().tintColor = UIColor.white
    })

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM