فهرست منبع

scroll to top on cancel search

nayooti 5 سال پیش
والد
کامیت
eafe2e2871
1فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  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
     }
 }