iOS 13奇怪的搜索控制器差距 [英] iOS 13 strange search controller gap
问题描述
在iOS 13 beta 6上使用Xcode 11 beta 5运行该应用程序时,在显示搜索结果视图控制器时遇到了奇怪的缝隙:
When running the App on iOS 13 beta 6, using Xcode 11 beta 5 I'm encountering the strange gap when presenting search results view controller:
这是如何设置的:
let searchResultsController = BLSearchResultsController()
let ret = UISearchController(searchResultsController: searchResultsController)
ret.searchResultsUpdater = self
ret.delegate = self
ret.searchBar.delegate = self;
ret.searchBar.autocapitalizationType = .none
ret.searchBar.placeholder = NSLocalizedString("SearchMsg", comment: "")
ret.searchBar.enablesReturnKeyAutomatically = true
if #available(iOS 13.0, *) {
ret.searchBar.showsScopeBar = false
ret.searchBar.backgroundColor = .white
let searchTextField = ret.searchBar.searchTextField
searchTextField.font = UIFont.tuttiRegularFont(16)
searchTextField.accessibilityIdentifier = "Main Search Field"
if let searchImageView = searchTextField.leftView as? UIImageView {
searchImageView.image = UIImage(named: "home-search-icon")
}
}
结果搜索控制器是普通的 UITableViewController
,并且刚刚添加到了 navigationItem.searchController
中.没有精美的演示代码.当在最新的实时Xcode上构建并在iOS 11/12设备上运行时,不存在此问题,这使我相信一些潜在的iOS 13更改可能导致此故障.
The results search controller is a normal UITableViewController
and is just added to the navigationItem.searchController
. There is no fancy presentation code. When building on latest live Xcode and running on the iOS 11/12 device this issue is not present which lead me to believe some underlying iOS 13 change might be causing this glitch.
在调试视图层次结构时,结果视图控制器似乎未到达移动的搜索栏的顶部.
我尝试摆弄 modalPresentationModes
,试图排除对演示文稿所做的更改可能是起因,没有运气的可能性.
I've tried fiddling with the modalPresentationModes
trying to exclude the possibility that the changes to the presentation could be the cause, had no luck there.
有人遇到过这个问题,并且运气好吗?
Has anyone encountered this issue and had luck fixing it?
推荐答案
设置
extendedLayoutIncludesOpaqueBars = true
用于显示搜索结果的 UIViewController
中的
,为我解决了此问题.
in the UIViewController
used to show the search results, fixed the issue for me.
这篇关于iOS 13奇怪的搜索控制器差距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!