gpt4 book ai didi

ios - UISearchController 中的搜索图标被截断

转载 作者:行者123 更新时间:2023-12-04 04:41:02 26 4
gpt4 key购买 nike

当我将 UISearchController 的搜索栏中的占位符文本更新为比搜索栏更宽的内容时,搜索图标会发生这种情况:

enter image description here

我通过在 viewDidLoad 中调用以下方法添加了 UISearchController 和搜索栏:

private func initSearchController() {

searchResultsController = UITableViewController()
searchResultsController.tableView.backgroundColor = UIColor(red: 51/255, green: 51/255, blue: 51/255, alpha: 1.0)
searchController = UISearchController(searchResultsController: searchResultsController)
searchResultsController.tableView.rowHeight = 50

let textFieldInsideSearchBar = searchController.searchBar.valueForKey("searchField") as? UITextField
textFieldInsideSearchBar?.textColor = UIColor.whiteColor()
searchController.searchBar.sizeToFit()
searchController.searchBar.placeholder = "SOL Southwest Kitchen & Tequila Bar"

searchController.hidesNavigationBarDuringPresentation = false
searchController.dimsBackgroundDuringPresentation = true
searchController.searchBar.searchBarStyle = .Minimal
navigationItem.titleView = searchController.searchBar
definesPresentationContext = true

searchController.searchResultsUpdater = self
searchResultsController.tableView.dataSource = self
searchResultsController.tableView.delegate = self
searchController.searchBar.delegate = self

}

什么给了?另外,无论如何要删除后退按钮和搜索栏之间的奇怪间隙?如果有帮助,这个 View 是导航 Controller 中的第二个 View Controller 。使用 iOS9 和 Swift 2.1。谢谢!

最佳答案

这似乎是不可能的,除非使用按钮、图像和文本字段创建自定义搜索栏。

关于ios - UISearchController 中的搜索图标被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33832463/

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