Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change color of CNContactPickerViewController searchBar

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.

like image 569
tmiedema Avatar asked Sep 11 '17 18:09

tmiedema


1 Answers

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)
like image 167
Tran Trung Hieu Avatar answered Oct 22 '22 09:10

Tran Trung Hieu