【发布时间】:2019-03-12 08:52:56
【问题描述】:
我有一个tableView。我设置了有关 searchController 的所有设置(大型导航栏中的搜索栏)-(滚动 tableview 时打开/关闭)。我实现了rightBarButtonItem,名称为 'Close' 。我想以编程方式隐藏/关闭 tableView 和搜索栏。我可以隐藏 tableView 但不能隐藏 SearchBar。
当我为 SearchBar 执行 isHidden 时,大型导航栏不会缩小到正常大小。
图 1. 向下滚动打开搜索栏。
图 2. 未以编程方式隐藏大型导航栏(此处未实现 searchar.isHidden)
提前致谢。
我之前尝试过,但没有运行
tableView.setContentOffset(.zero, animated: false)
navigationController?.navigationBar.prefersLargeTitles = false
【问题讨论】:
-
在隐藏搜索控制器时需要设置prefer-large 导航栏标题为false
-
我不使用大标题,我也试过了
-
导航搜索栏或 UIsearchBar 你在用什么。 ?
-
UISearchController
-
@codeByThey 你能分享一下你的代码吗?
标签: ios swift uitableview uinavigationcontroller uisearchbar