UISearchBar显示在Overlay之上

时间:2015-11-06 18:05:48

标签: ios swift uitableview uisearchbar uisearchcontroller

我的应用在表格视图标题中有一个UITableViewUISearchController 点击表格单元格会显示对话框/叠加层。叠加是UIVisualEffectView

问题:搜索栏显示在叠加层上,如图所示 the MDN

我在视图控制器上设置definesPresentationContext = true,设置我的UISearchController的代码如下......

lazy var resultSearchController: UISearchController = ({
  let controller = UISearchController(searchResultsController: nil)
  controller.searchResultsUpdater = self
  controller.dimsBackgroundDuringPresentation = false
  controller.searchBar.sizeToFit()
  controller.hidesNavigationBarDuringPresentation = false
  controller.searchBar.delegate = self
  return controller
})()

在叠加层上将hidden设置为false后。我把它带到前面......

welcomeLabel.text = user!.fullName.isEmpty ? "Hello, \(user!.name)" : "Hello, \(user!.fullName)"
self.view.bringSubviewToFront(loginBackground)
self.view.bringSubviewToFront(loginContainer)

仅当搜索栏处于活动状态时才会出现此问题。有人知道解决方法吗?

谢谢!

0 个答案:

没有答案