我对UISearchBar有以下设置:
searchBar?.tintColor = UIColor.clear
searchBar?.barTintColor = UIColor.clear
searchBar?.backgroundColor = UIColor.clear
searchBar?.layer.backgroundColor = UIColor.clear.cgColor
searchBar?.layer.borderColor = UIColor.clear.cgColor
searchBar?.layer.shadowColor = UIColor.clear.cgColor
searchBar?.backgroundImage = UIImage()
这就是UISearchBar
出现的方式:
激活:
我不知道我在哪里得到背景中的灰色。我继承了使用UIAppearence
Proxy
的代码库,但我没有看到UISearchBar
的任何内容。也许,searchBar
从其他地方继承它。
关于如何摆脱灰色的任何想法?
答案 0 :(得分:0)
首先,删除所有这些:
searchBar?.tintColor = UIColor.clear
searchBar?.barTintColor = UIColor.clear
searchBar?.backgroundColor = UIColor.clear
searchBar?.layer.backgroundColor = UIColor.clear.cgColor
searchBar?.layer.borderColor = UIColor.clear.cgColor
searchBar?.layer.shadowColor = UIColor.clear.cgColor
searchBar?.backgroundImage = UIImage()