gpt4 book ai didi

ios - 导航项中的搜索 Controller 显示黑条

转载 作者:行者123 更新时间:2023-11-29 05:44:51 24 4
gpt4 key购买 nike

您好,我已经使用设置搜索 Controller

private func setupSearchbar() {
searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.obscuresBackgroundDuringPresentation = false
searchController.searchBar.placeholder = "Search Contacts"

self.navigationItem.searchController = searchController
self.definesPresentationContext = true

}

在我添加此代码之前一切都工作正常

    UINavigationBar.appearance().isOpaque = true
UINavigationBar.appearance().isTranslucent = false
UINavigationBar.appearance().barTintColor = UIColor(named: "PrimaryDark")
UINavigationBar.appearance().tintColor = UIColor.white
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.font:Constants.AppTheme.Fonts.font(type: .FONT_BOLD, size: 22) ,NSAttributedString.Key.foregroundColor:UIColor.white]

UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedString.Key.font:Constants.AppTheme.Fonts.font(type: .FONT_BOLD, size: 34) ,NSAttributedString.Key.foregroundColor:UIColor.white]

现在,当我点击搜索栏时,会出现大底黑条

如何解决这个问题?

查看调试

enter image description here

enter image description here

最佳答案

好的,我可以解决这个问题。我分享此内容可能会对面临相同问题的其他人有所帮助。

解决这个问题。在 View 中将出现我已将 self.extendedLayoutIncludesOpaqueBars 设置为 true

的方法
 override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.extendedLayoutIncludesOpaqueBars = true

}

希望对某人有帮助:)

这里是输出

enter image description here

关于ios - 导航项中的搜索 Controller 显示黑条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56250292/

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