0
因此,我的搜索欄看起來像這樣,它通過UISearchController
調用。除了一件事以外,這一切都很好。 半透明狀態欄重疊UITableView內容
向下滾動搜索列表將顯示在狀態欄下的結果,因爲它是透明的,這樣
我用一對夫婦的「醜陋」的修復得到這個期待並以它的方式工作,問題顯然在於參數translucent = true
。任何人都可以看到我的問題的快速解決方案?除了在上面放置另一個空的,不透明的視圖並使其變成白色的ofc。我有另外一個問題今天早些時候和解決this問題是,爲什麼出現這種情況的原因..
func willPresentSearchController(searchController: UISearchController) {
if let navBarFont = UIFont(name: "HelveticaNeue-Light", size: 25.0) {
let navBarAttributesDictionary: [String: AnyObject]? = [
NSForegroundColorAttributeName: PinkColor,
NSFontAttributeName: navBarFont
]
self.navigationController?.navigationBar.titleTextAttributes = navBarAttributesDictionary
}
self.navigationController?.navigationBar.translucent = true
self.navigationController?.navigationBar.barTintColor = UIColor.whiteColor()
self.navigationController?.navigationBar.backgroundColor = UIColor.whiteColor()
searchController.searchBar.backgroundColor = UIColor.whiteColor()
self.navigationController?.navigationBar.topItem?.title = "Find Friends"
self.refreshControl?.backgroundColor = UIColor.whiteColor()
self.refreshControl?.tintColor = self.GrayColor
}
func willDismissSearchController(searchController: UISearchController) {
if let navBarFont = UIFont(name: "HelveticaNeue-Light", size: 25.0) {
let navBarAttributesDictionary: [String: AnyObject]? = [
NSForegroundColorAttributeName: UIColor.whiteColor(),
NSFontAttributeName: navBarFont
]
self.navigationController?.navigationBar.titleTextAttributes = navBarAttributesDictionary
}
UIView.animateWithDuration(0.3) {() -> Void in
self.navigationController?.navigationBar.translucent = false
self.navigationController?.navigationBar.backgroundColor = self.PinkColor
self.navigationController?.navigationBar.barTintColor = self.PinkColor
searchController.searchBar.backgroundColor = self.PinkColor
self.refreshControl?.backgroundColor = self.PinkColor
self.refreshControl?.tintColor = UIColor.whiteColor()
self.navigationController?.navigationBar.topItem?.title = "Friends"
}
}