Ios 搜索栏在滚动中消失,如何防止此操作
我的搜索栏在滚动时似乎消失了,即使我正在使用Ios 搜索栏在滚动中消失,如何防止此操作,ios,swift,Ios,Swift,我的搜索栏在滚动时似乎消失了,即使我正在使用 navigationController?.hidesBarsOnSwipe = false 下面也使用 navigationItem.searchController = searchController 无效 似乎没有任何效果,我为搜索控制器添加的代码是 searchControlInstance = UISearchController(searchResultsController: nil) searchC
navigationController?.hidesBarsOnSwipe = false
下面也使用
navigationItem.searchController = searchController
无效
似乎没有任何效果,我为搜索控制器添加的代码是
searchControlInstance = UISearchController(searchResultsController: nil)
searchControlInstance.searchResultsUpdater = self
searchControlInstance.obscuresBackgroundDuringPresentation = false
self.definesPresentationContext = true
searchControlInstance.searchBar.returnKeyType = .done
navigationItem.hidesSearchBarWhenScrolling = false
我确实有
navigationController?.navigationBar.prefersLargeTitles = true
但将其设置为false似乎没有任何效果搜索栏就像图中一样消失了,我在哪里犯了错误,有人能建议,我不使用故事板吗
navigationItem.searchController = searchControlInstance
navigationItem.hidesSearchBarWhenScrolling = false
您必须这样设置:
navigationItem.searchController = searchControlInstance
navigationItem.hidesSearchBarWhenScrolling = false
是的。。您需要同时设置:)我得到了相同的结果,我在回答中提到了这一点,谢谢任何其他需要添加内容的设置?嗯,我想您没有同时尝试这两种设置。嘿,成功了,我需要禁用navigationController?.hidesBarsOnSwipe=true,谢谢。。您需要同时设置:)我得到了相同的结果,我在回答中提到了这一点,谢谢任何其他需要添加内容的设置?嗯,我想您没有同时尝试这两种设置。嘿,成功了,我需要禁用navigationController?.hidesBarsOnSwipe=true,谢谢