简体   繁体   中英

Change background color of uisearchcontroller

How does one change the background colour of the uisearchcontroller? Atm it looks like this 在此输入图像描述

I want it all one colour. I've attempted sc.view.tintColor = UIColor.rgb(10, green: 150, blue: 255) and sc.view.backgroundColor = UIColor.rgb(10, green: 150, blue: 255) but doesn't remove the grey bit the side

呃,有些想法我解决了它。

sc.searchBar.barTintColor = UIColor.rgb(10, green: 150, blue: 255)

     sc.searchBar.searchBarStyle = UISearchBarStyleProminent
     sc.searchBar.backgroundImage = [UIImage new]
     sc.searchBar.barTintColor = UIColor.rgb(10, green: 150, blue: 255)

set searchBarStyle to Prominent. It working for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM