Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 更改顶部状态栏';s SearchResultController的颜色(使用Swift)_Xcode_Swift_Xcode6_Uisearchbar_Uisearchresultscontroller - Fatal编程技术网

Xcode 更改顶部状态栏';s SearchResultController的颜色(使用Swift)

Xcode 更改顶部状态栏';s SearchResultController的颜色(使用Swift),xcode,swift,xcode6,uisearchbar,uisearchresultscontroller,Xcode,Swift,Xcode6,Uisearchbar,Uisearchresultscontroller,我创建了一个搜索栏。当我搜索某物时,SearchResultController出现并显示结果。但是状态栏全是白色的!问题是我将状态栏样式更改为白色,并且状态背景也为白色=>现在所有内容都为白色:( 此处的情况截图: 请问如何更改这行中的状态背景 override func viewDidLoad() { super.viewDidLoad() UIApplication.sharedApplication().statusBarStyle = .LightContent

我创建了一个搜索栏。当我搜索某物时,SearchResultController出现并显示结果。但是状态栏全是白色的!问题是我将状态栏样式更改为白色,并且状态背景也为白色=>现在所有内容都为白色:(

此处的情况截图:

请问如何更改这行中的状态背景

override func viewDidLoad() {
    super.viewDidLoad()
    UIApplication.sharedApplication().statusBarStyle = .LightContent

    self.resultSearchController = ({
        let controller = UISearchController(searchResultsController: nil)
        controller.searchResultsUpdater = self
        controller.dimsBackgroundDuringPresentation = false
        controller.searchBar.sizeToFit()            


        self.tableView.tableHeaderView = controller.searchBar

        return controller
    })()
PS:我正在使用Xcode 6.3.2和Swift。
干杯!

你不应该改变导航栏的颜色吗?如果我理解你的问题的话

 let navbar = UINavigationBar.appearance()
 navbar.barTintColor = UIColor(red: 22.0/255, green: 33.0/255, blue:      37.0/255, alpha: 1)

试试看有没有什么变化。

你不能直接换成白色或黑色以外的其他颜色


我已经了解到,您可以在导航栏和状态栏后面放置一个视图,并将其颜色更改为您感兴趣的颜色。

不,谢谢,但我不想这样做。我只想在使用SearchResultsController时更改状态栏的背景色。如果您没有更改,请查看我在问题中提到的图像。我会的(举例说明我的想法;)