如何更改CNContactPickerViewController searchBar的颜色 [英] How to change color of CNContactPickerViewController searchBar

查看:59
本文介绍了如何更改CNContactPickerViewController searchBar的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从视图控制器启动CNContactPickerViewController,但是如何更改其中的搜索栏的文本颜色.导航栏为深蓝色,在iOS11中,默认的搜索栏文字为黑色.

I start a CNContactPickerViewController from a viewcontroller, but how can I change the textcolor of the searchbar inside it. The navigationbar is dark blue, in iOS11 the default searchbartext is black.

推荐答案

我更新了快速修复的方法在展示CNContactPickerViewController之前,您应该设置UISearchBar的背景颜色

I updated the way to fix in swift Before you present CNContactPickerViewController, you should set background color of UISearchBar

            UISearchBar.appearance().backgroundColor = UIColor.white
        let cancelButtonAttributes = [NSForegroundColorAttributeName: ColorConstant.baseColorGray]
        UIBarButtonItem.appearance(whenContainedInInstancesOf:
         [UISearchBar.self]).setTitleTextAttributes(cancelButtonAttributes, for: .normal)

这篇关于如何更改CNContactPickerViewController searchBar的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆