在UISearchController中按“取消”后,导航栏被阻止

Edg*_*man 5 swift ios13 ipados13

我正在为iOS 13准备应用程序,并在导航栏中获取搜索控制器的错误。如何解决导航栏故障?

let search = UISearchController(searchResultsController: nil)

search.dimsBackgroundDuringPresentation = false
search.searchResultsUpdater = self
search.hidesNavigationBarDuringPresentation = false
self.definesPresentationContext = true
search.searchBar.isTranslucent = false

self.navigationItem.searchController = search

self.navigationItem.hidesSearchBarWhenScrolling = true
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

按“取消”,导航栏项将变为不可触摸。推视图控制器导致导航栏项目重叠。

在此处输入图片说明

我已经在git https://github.com/eKroman/TESTsearchBar上创建了测试项目

使用从beta 7(可能是较旧的beta)到Xcode 11 GM种子2的Xcode 11,在iOS 13 beta(在iPad上测试)中出现错误。在模拟器上未出现。

Coa*_*hys 10

我遇到了同样的问题,如果我取消了searchBar并更改了navigationItem.title,那么我会有一个双标题。就像导航栏的幻影层保留在导航控制器中一样。

这是我解决的方法:

searchController.hidesNavigationBarDuringPresentation = true
Run Code Online (Sandbox Code Playgroud)

在Apple解决此问题之前,最好使用它。

我还注意到后退按钮切换为默认颜色(蓝色),就像将navigationBar TintColor重置了一样。

配置:-Xcode 11.0(11A420a)-iOS 13.1(17A5844a)