gpt4 book ai didi

ios - 在开始时隐藏自定义搜索栏

转载 作者:行者123 更新时间:2023-11-28 12:51:04 24 4
gpt4 key购买 nike

在我的 swift 2 应用程序中,我有一个 TableView Controller 我在其中添加了自定义搜索栏(深灰色行)

在我调用的 viewDidLoad 中

configureCustomSearchController()

这是函数:

  func configureCustomSearchController() {
customSearchController = CustomSearchController(
searchResultsController: self,
searchBarFrame: CGRectMake(0.0, 0.0, MyTable.frame.size.width, 50.0),
MyTable.tableHeaderView = customSearchController.customSearchBar
customSearchController.searchBar.sizeToFit()
customSearchController.customDelegate = self
}



func updateSearchResultsForSearchController(searchController: UISearchController) {
// DO SOMETHING
}

func didStartSearching() {
// DO SOMETHING
}


func didTapOnSearchButton() {
// DO SOMETHING
}


func didTapOnCancelButton() {
// DO SOMETHING
}

func didChangeSearchText(searchText: String) {
// DO SOMETHING
}

enter image description here

我的问题是,如果我的 tableview 会出现并在下拉时显示侧边栏,我该如何隐藏搜索器。

下拉刷新功能可用。

最佳答案

我找到了我的解决方案:

viewDidLoad

MYTable.contentInset = UIEdgeInsets(top: -1, left: 0, bottom: 0, right: 0)

这会在开始时隐藏搜索栏,如果我向上滚动一点,搜索栏就会可见

关于ios - 在开始时隐藏自定义搜索栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36515527/

24 4 0