无法在UINavigationBar的searchController中聚焦searchBar

时间:2019-06-04 13:15:41

标签: ios swift uinavigationcontroller uisearchcontroller

就像在主题中一样-尽管我设置了该委托并处于活动状态,但我无法聚焦searchBar。 这是我来自viewdidLoad()的代码:

let searchController = UISearchController(searchResultsController: nil)
    searchController.delegate = self as? UISearchControllerDelegate
    searchController.searchBar.delegate = self
    searchController.isActive = true
    self.definesPresentationContext = false
    let newSearchBar = searchController.searchBar

我也设置了var searchBar: UISearchBar!searchBar = newSearchBar

看起来就像在应用程序中一样:{{3}}

无论如何,当我单击此搜索栏然后在键盘上单击TAB时,我就无法写东西...

0 个答案:

没有答案