Explorar o código

scroll to top on cancel search

nayooti %!s(int64=5) %!d(string=hai) anos
pai
achega
eafe2e2871
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      deltachat-ios/Controller/ChatListController.swift

+ 8 - 0
deltachat-ios/Controller/ChatListController.swift

@@ -356,5 +356,13 @@ extension ChatListController: UISearchBarDelegate {
 
     func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
         viewModel.endSearch()
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
+           self.tableView.scrollToTop()
+        }
+    }
+
+    func searchBar(_ searchBar: UISearchBar, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
+        tableView.scrollToTop()
+        return true
     }
 }