简体   繁体   English

iOS 9联系人列表按钮白色

[英]iOS 9 Contact List buttons White on White

I realize that ABPeoplePicker has changed for iOS 9 but the functionality is still there and working for now. 我意识到ABPeoplePicker已针对iOS 9进行了更改,但该功能仍然存在并且目前可以正常使用。 The issue I am having is that the "Group" and "Cancel" buttons are coming up as white on a white background. 我遇到的问题是“组”和“取消”按钮在白色背景上显示为白色。 So very hard to see. 很难看。 The previous controller that this is coming from does make use of white buttons on its nav bar but of course the background is darker. 以前使用的控制器确实在其导航栏中使用了白色按钮,但背景当然更暗。

I have tried to use the following which works under iOS 8 but seems to do nothing under iOS 9: 我尝试使用以下在iOS 8下有效的方法,但在iOS 9下似乎无能为力:

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

I have tried to directly set it as well with the navigationcontroller.navbar.tintcolor property. 我试图直接使用navigationcontroller.navbar.tintcolor属性进行设置。 That didn't work under 8 or 9. 在8岁或9岁以下无法正常工作。

How can I get these buttons to be visible on the contact page? 如何使这些按钮在联系人页面上可见?

Update: I have also tried this which doesn't work either: 更新:我也尝试过这不起作用:

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

Update 2: I tried using the new CNContactPickerViewController and it does the same thing with white on white. 更新2:我尝试使用新的CNContactPickerViewController并且在白底白字上也做同样的事情。

I also faced this issue earlier. 我之前也遇到过这个问题。 To fix this, you need to set tint colour for UINavigation bar like below: 要解决此问题,您需要为UINavigation栏设置色调颜色,如下所示:

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

ex: 例如:

- (void)showContactList 
{

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

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

    picker.peoplePickerDelegate = self;

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

I don't know how but this worked for me: 我不知道如何,但这对我有用:

// 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