             updateSearchResultsForSearchController(searchController)
         }
     }
+
+    func searchBarSearchButtonClicked(searchBar: UISearchBar) {
+        self.searchBarSearchButtonClicked = true
+    }
+
+    func searchBarCancelButtonClicked(searchBar: UISearchBar) {
+        if let bottom = normalContactsTableViewContentInsetBottom {
+            self.contactsTableView.contentInset.bottom = bottom
+            self.contactsTableView.scrollIndicatorInsets.bottom = bottom
+        }
+    }
 }
 
 extension ContactsViewController: UISearchControllerDelegate {

    private var searchControllerIsActive: Bool {
        return searchController?.active ?? false
    }

    private let keyboardMan = KeyboardMan()
    private var normalContactsTableViewContentInsetBottom: CGFloat?

        }

        keyboardMan.animateWhenKeyboardDisappear = { [weak self] _ in
            /*
            if let bottom = self?.normalContactsTableViewContentInsetBottom {
                self?.contactsTableView.contentInset.bottom = bottom
                self?.contactsTableView.scrollIndicatorInsets.bottom = bottom
            }
            */
            if self?.searchBarSearchButtonClicked ?? false {
                self?.contactsTableView.contentInset.bottom = 0
                self?.contactsTableView.scrollIndicatorInsets.bottom = 0
            } else {
                if let bottom = self?.normalContactsTableViewContentInsetBottom {
                    self?.contactsTableView.contentInset.bottom = bottom
                    self?.contactsTableView.scrollIndicatorInsets.bottom = bottom
                }
            }
            self?.searchBarSearchButtonClicked = false
        }

        #if DEBUG
