UISearchController's default animation will shift searchBar to the top.

This will trigger rx_contentOffset then close keyboard will makes users confused.
Filter situation that searchController is being present.
This commit is contained in:
Calvin 2016-04-22 12:30:28 +09:00
parent 66abcd07dc
commit 68bf69e086
1 changed files with 5 additions and 1 deletions

View File

@ -80,9 +80,13 @@ class WikipediaSearchViewController: ViewController {
func configureKeyboardDismissesOnScroll() {
let searchBar = self.searchBar
let searchController = self.searchController
resultsTableView.rx_contentOffset
.asDriver()
.filter { _ -> Bool in
return !searchController.isBeingPresented()
}
.driveNext { _ in
if searchBar.isFirstResponder() {
_ = searchBar.resignFirstResponder()