1

當前,我的搜索控制器「導航欄」背景是標準的默認半透明,但是,我的應用中的所有其他酒吧都是黑色半透明的。當我打印searchController的navigationController屬性時,它返回nil,navigationBar也會返回,但不是導航項。有沒有其他公共財產,似乎讓你改變酒吧的顏色。我不介意重寫私人ivars,因爲我不會在應用商店發佈這款應用。更改UINavigationBar UISearchController的背景顏色

回答

2

可以使用barTintColor屬性,在斯威夫特這將是:

searchBar.barTintColor = UIColor.redColor()