gpt4 book ai didi

ios - 状态栏在搜索时改变颜色

转载 作者:搜寻专家 更新时间:2023-10-31 08:33:28 24 4
gpt4 key购买 nike

我正在使用 UISearchController,单击它时,它会使导航栏上升并将状态栏变为白色。我希望状态栏保持绿色。

我的 UISearchController 实现:

self.resultSearchController = ({
let controller = UISearchController(searchResultsController: nil)
controller.searchResultsUpdater = self
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
controller.searchBar.placeholder = "Pesquisa por linha ou cod..."
controller.searchBar.tintColor = UIColor(netHex: 0xFFFFFF)
controller.searchBar.barTintColor = UIColor(netHex: 0x2F7C30)
controller.searchBar.clipsToBounds = true
controller.searchBar.layer.borderWidth = 1;
controller.searchBar.layer.borderColor = UIColor(netHex: 0x2F7C30).CGColor
self.navigationController!.view.backgroundColor = UIColor(netHex: 0x2F7C30)

self.tableView.tableHeaderView = controller.searchBar

return controller
})()

点击搜索栏之前 Before clicking on the search bar

点击搜索栏后 After clicking on the search bar

最佳答案

模仿 Daniel Storm 的回应。将 subview 添加到 UISearchController 的 View 为我解决了这个问题。

let statusBarView = UIView(frame: CGRectMake(0, 0,
UIApplication.sharedApplication().statusBarFrame.size.width,
UIApplication.sharedApplication().statusBarFrame.size.height))
statusBarView.backgroundColor = Colors.Primary.Regular
searchController.view.addSubview(statusBarView)

关于ios - 状态栏在搜索时改变颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32234778/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com