gpt4 book ai didi

ios - 当该页面出现时,如何在 UISearchController 中自动启用搜索栏?

转载 作者:行者123 更新时间:2023-11-30 11:55:32 31 4
gpt4 key购买 nike

这是关于我在应用程序中搜索的代码。

    self.searchController = UISearchController(searchResultsController:  nil)
self.searchController.searchResultsUpdater = self
self.searchController.delegate = self
self.searchController.searchBar.delegate = self
self.searchController.hidesNavigationBarDuringPresentation = false
self.searchController.dimsBackgroundDuringPresentation = true
self.searchController.searchBar.tintColor = UIColor.gray
self.navigationItem.titleView = searchController.searchBar
self.definesPresentationContext = true

我想让我的搜索栏在页面出现时自动激活?

有人有想法吗?你可以看我的图片就清楚了。

enter image description here

最佳答案

尝试添加到viewWillAppear self.searchController.searchBar.becomeFirstResponder()

关于ios - 当该页面出现时,如何在 UISearchController 中自动启用搜索栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47863577/

31 4 0