我正在使用这个库:https://github.com/xmartlabs/XLPagerTabStrip
我的问题是我无法解决为 ButtonBarPagerTabStripViewController
subview Controller 之一添加 UISearchController - UITableViewController
的问题。
尝试在 iOS 11+ 下添加时,搜索栏不会出现,如下所示:
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = true
当尝试将 UISearchBar
添加到 tableView
时:
tableView.tableHeaderView = searchController.searchBar
然后在点击搜索字段后,整个 UISearchBar
消失了。
您知道如何在 UITableViewController
中将 ButtonBarPagerTabStripViewController
作为子项之一实现 UISearchController
的正确方法吗?
最佳答案
似乎是一个迟来的答案,但希望能帮助其他可能遇到同样问题的人。
将以下属性添加到您的搜索栏可解决此问题:
searchController.hidesNavigationBarDuringPresentation = false
searchController.definesPresentationContext = false
关于ios - XLPagerTabStrip - 如何添加 UISearchController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48205214/