簡體   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