【问题标题】:iOS 9 Contact List buttons White on WhiteiOS 9 联系人列表按钮白底白字
【发布时间】:2015-09-21 22:05:11
【问题描述】:

我意识到 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,它对白底白字做同样的事情。

【问题讨论】:

  • 您是否尝试过为该视图控制器设置栏样式而不是使用appearanceWhenContainedIn:
  • 我试过 [self.picker.navigationBar setBarStyle:UIBarStyleDefault]; [self.picker.navigationBar setTintColor:[UIColor blueColor]];什么都不做。

标签: objective-c xcode ios9 abpeoplepickerview


【解决方案1】:

我之前也遇到过这个问题。要解决此问题,您需要为 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];
}

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-23
      • 1970-01-01
      • 2019-09-04
      • 1970-01-01
      • 1970-01-01
      • 2016-05-24
      相关资源
      最近更新 更多