UISearchController iOS 11 Customization

后端 未结 9 1344
南旧
南旧 2021-01-29 21:40

I had been using the following code prior to iOS 11 to customize the appearance of the UISearchController search bar:

var searchController = UISearc         


        
9条回答
  •  南笙
    南笙 (楼主)
    2021-01-29 22:31

    You have to access the UITextField inside the UISearchBar. You can do that by using

    let textFieldInsideSearchBar = yourSearchbar.value(forKey: "searchField") as? UITextField
    
    textFieldInsideSearchBar?.textColor = yourcolor
    

    OR

提交回复
热议问题